python读写txt文件的常用操作:
1、读取txt文件全部内容
def txt_read(file_name):
""" 读取txt文件全部内容
"""
with open(file_name, 'r') as fp:
data_str = fp.read()
2、按行读取txt文件全部内容</
python读写txt文件的常用操作:
1、读取txt文件全部内容
def txt_read(file_name):
""" 读取txt文件全部内容
"""
with open(file_name, 'r') as fp:
data_str = fp.read()
2、按行读取txt文件全部内容</