Академический Документы
Профессиональный Документы
Культура Документы
Course Module 4 Files Files import, open & read .read() method
Previous Next
.read() method
Bookmark this page
.read() method
Start of transcript. Skip to the end.
Video Transcripts
Download video le Download SubRip (.srt) le
Download Text (.txt) le
Concept
reading text
poem_contents = poem_file.read()
.read() loads the content of the le into memory as a string, including formatting such as new line (\n)
Examples
examples expect that the cells that import and open of poem1.txt has been run without a read()
Run the cells that import and open poem1.txt
Task 2
read a le
1. ensure the code was created and run in task 1 to import cities.txt
Previous Next