The python readline () and readlines ()

The difference between the () .readline () and .readlines latter read the entire file once, like .read () the same. .readlines () automatically analyzes the contents of the file into a list of lines, this list can be processed by the structure in ... Python's for .... On the other hand, .readline () only reads one line each time, usually much slower than .readlines (). Only when there is not enough memory to read the entire file once, it should be used .readline ().

Guess you like

Origin www.cnblogs.com/yibeimingyue/p/11238402.html