Novice level Python learner and working on macos Catalina with newly downloaded Python 3.8 installation, using Jupyter Notebook.
readlines() is returning all one line with \n, separators instead of individual lines.
foo = open('foo.txt')
foo.seek(0)
foo.readlines()
Returns:
['Something on line 1.\n', 'Something on line 2.\n', 'Something on line 3.']
The foo.txt file looks like this:
Something on line 1.
Something on line 2.
Something on line 3.
Am I right in thinking this is not expected behaviour? I can't find a similar query here. Thank you.
Edit - this is how it appears in Jupyter Notebook on the tutorial. Perhaps that is a Notebook setting?