June 2017
Beginner
352 pages
8h 39m
English
If you now exit the REPL, and look in your filesystem you can see that you have indeed created a file. On Unix use the ls command:
$ ls -l-rw-r--r-- 1 rjs staff 78 12 Jul 11:21 wasteland.txt
You should see the wasteland.txt file with 78 bytes.
On Windows use dir:
> dir Volume is drive C has no label. Volume Serial Number is 36C2-FF83 Directory of c:\Users\pyfund12/07/2013 20:54 79 wasteland.txt 1 File(s) 79 bytes 0 Dir(s) 190,353,698,816 bytes free
In this case you should see wasteland.txt with 79 bytes because Python's universal newline behavior for files has translated the line ending to your platform's native endings.
The number returned by the write() method is the number of codepoints (or characters) in the ...
Read now
Unlock full access