Week 3 subject 1: File Operations
- File means text files. It's a giant leap forward which means you are finally free from keystrokes and can now process something much more complex and more meaningful!
- Always use the open() function to open a file before using, which returns a File object you'll need to refer to whenever you need to operate a file.
- Always use the .close() method to close the file after use.
- Read from files using:
- .read(number of characters)
- .readline()
No comments:
Post a Comment