#Python - Open and read file

open

f = open(path)

read

  • f.read() using once to read entire file
  • f.readlines() use once to read one line
  • for line in f loop over the file, most useful

你可能感兴趣的:(#Python - Open and read file)