其它常用
1.导出列表
def totxt(resultname,L):
f=open(resultname,"w")
for name in L:
f.write(str(name)+'\n')
f.close()
2.读入列表
def txttolist(file_path):
fi=open(file_path,'r')
txt=fi.readlines()
L = []
for w in txt:
w=w.replace('\n','')
L.append(int(w))
return L

浙公网安备 33010602011771号