I am learning Python and using Jupyter to write Python code. I am working on File Handling currently.
My Code goes like this:
file = open(r"C:\USERS\PRAGA\DESKTOP\TestFile.txt",'w')
file.write("I can do it")
file.close()
file = open(r"C:\USERS\PRAGA\DESKTOP\TestFile.txt",'a')
file.write("\nBelieve in yourself. Yes, you can do it.")
file = open(r"C:\USERS\PRAGA\DESKTOP\TestFile.txt",'r')
Last_content = file.read()
Last_content
The final answer is
I can do it\nBelieve in yourself. Yes, you can do it.
Expected answer:
I can do it
Believe in yourself. Yes, you can do it.
When I opened the text file, the expected answer is coming but but not getting displayed in the editor.
Why the newline character is not working?