05-python-文件读写

f    = open(name, "r")  ## 'w'

line = f.readline()

content = f.read(N)          # 读取N bytes的数据

content = f.readline()       # 读取一行

content = f.readlines()      # 读取所有行,储存在列表中,每个元素是一行。

f.write('abc')

f.close()

猜你喜欢

转载自www.cnblogs.com/yeran/p/10483209.html