So I have a file that is in this format (no, this is not what the file looks exactly like)
aaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbb
ccccccccccccccccccc
ddddddddddddddddddd
I want to append a new line to the file so that it looks like
aaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbb
ccccccccccccccccccc
ddddddddddddddddddd
eeeeeeeeeeeeeeeeeee
but whenever I use
with open(filename, "a") as updatedFile:
nextLine="\n%s" % (lineToAdd)
updatedFile.write(nextLine)
I get
aaaaaaaaaaaaaaaaaaa
bbbbbbbbbbbbbbbbbbb
ccccccccccccccccccc
ddddddddddddddddddd
eeeeeeeeeeeeeeeeeee
How would I go about fixing this?