I was practicing opening, reading and writing to files within python3.6 directly.
I created a file called days.txt and listed the days of the week in it. Then I opened the file in write mode and confirmed from Atom it was truncated.
But when I tried to write "Sunday" to the file but it returned a character count of 6 instead of writing "Sunday" to the file.
So then I wrote the same lines of code in a script, saved it and ran it and it worked. It wrote the information to the file.
Why does it work when run as a script but not when run directly in python?
>>> fo = open("days.txt", 'w')
>>> fo.write("Sunday")
6
>>> fo.write("Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday")
62