I tried doing this:
with open("contactbook.txt","a") as f:
f.write("hello\n")
But it gets printed as:
'hello\n'
My code to read the file:
with open("contactbook.txt","r") as f:
lines = sorted(f.readlines())
print(lines)
EDIT:
I tried to check the text file and there \n really was interpreted as a linebreak!
But in python's shell it's still showing as \n
What am I doing wrong? Is it because of how I print it?