如何实现试用python实现文件的读取import sys,random
import getpass
filename = sys.argv[0]
f=open(filename,'r',encoding='utf8')
line_no=0
with open(filename,'r',encoding='utf8') as f:
for line in f:
line_no+=1
print(line_no,':',line)
f.close()
def ReadFile(filename):
with open(filename, 'r') as f:
content = f.read()
return content