Difference | python is read, readline, readlines and write, writelines

 

1, read | read, readline, readlines


 

  • read ([size]): reading the contents of the specified size, the default is to read all. (Caution Memory explosion)
  • readlines (): read out all , return values yes yes a List .
  • readline ():  read out only one line.

 

 

2, write | write, writelines (remember no writeline)


  • write (): write to a file, can be a string.

  • write_lines (): when writing data to an array list, for use writelines function , with the write function to be wrong.

 

 

Guess you like

Origin www.cnblogs.com/zwt20120701/p/12105330.html