python 读写

1、读

1 f = read('$filePath', 'r')
2 line = f.readline()    #读取一行
3 lines = f.readlines() #读取所有行

2、写

1 with open('$filePath', 'w') as fw:
2     fw.write(sth)
原文地址:https://www.cnblogs.com/lxc1910/p/11626650.html