Study Notes (08): Python interview talking about the difference between 100 (based on Python3.x) -read, readline method and readlines

Learning immediately: https://edu.csdn.net/course/play/26755/340106?utm_source=blogtoedu

There are three magical python read: read, readline and readlines

read (): one-time read the entire contents of the file. Recommended read (size), and the longer running time of greater size

readline (): read every single line. Not enough memory use, generally do not use

readlines (): one-time read the entire contents of the file, and press OK to return to the list, to help us traverse

We are generally small files using read (), you're sure about the size of a given size, large file to use readlines ()

 

readlines reading the configuration file still has some advantages
 

Published 17 original articles · won praise 0 · Views 181

Guess you like

Origin blog.csdn.net/weixin_43745945/article/details/104192533