Is there a way to split a string containing a newline character into a list of strings where the newline character has been retained, eg.
"amount\nexceeds"
would produce
["amount\n", "exceeds"]
Use splitlines(), passing keepends=True:
"amount\nexceeds".splitlines(keepends=True)
gives you:
["amount\n", "exceeds"]