赞
踩
统计文件文件中最长行的长度和该行的内容:
result=[0,'']with open('data.txt','r') as fp: for line in fp: t=len(line) if t>result[0]: result=[t,line]print(result)