Loading [MathJax]/jax/input/MathML/config.js
Skip to main content
Library homepage
 

Text Color

Text Size

 

Margin Size

 

Font Type

Enable Dyslexic Font
Engineering LibreTexts

Search

  • Filter Results
  • Location
  • Classification
    • Article type
    • Author
    • Set as Cover Page of Book
    • License
    • Show TOC
    • Transcluded
    • OER program or Publisher
    • Autonumber Section Headings
    • License Version
    • Print CSS
  • Include attachments
Searching in
About 1 results
  • https://eng.libretexts.org/Courses/Delta_College/Introduction_to_Programming_Concepts_-_Python/07%3A_Files/7.04%3A_Reading_Files
    While the file handle does not contain the data for the file, it is quite easy to construct a for loop to read through and count each of the lines in a file: The rough translation of the for loop into...While the file handle does not contain the data for the file, it is quite easy to construct a for loop to read through and count each of the lines in a file: The rough translation of the for loop into English is, "for each line in the file represented by the file handle, add one to the count variable." If you know the file is relatively small compared to the size of your main memory, you can read the whole file into one string using the read method on the file handle.

Support Center

How can we help?