文件内容优化

This commit is contained in:
lyf
2020-11-09 10:00:35 +08:00
parent da038257b8
commit ef44f3391e
3 changed files with 352 additions and 28 deletions

View File

@@ -80,32 +80,6 @@ class GetTime():
return "ture"
else:
return "false"
#文件写入
def lyf_list_write(self,path,a):
if type(a) == int:
a=str(a)
else:
a=a
with open(path, 'a+') as f:
f.write("\n"+a)
#文件读取
def lyf_list_read(self,path):
with open(path, 'r') as f:
b=f.read()
# print(b)
d = b.split()
print(d)
list1 = []
for i in d:
if type(i)==str:
z = int(i)
list1.append(z)
else:
i = i
list1.append(i)
print(list1)
return list1