Commit 0bdfa3f1 by BellCodeEditor

save project

parent 01110032
Showing with 7 additions and 2 deletions
sb=[]
with open(r"c:\Users\8\Documents\lesson13-3\sales_list.txt","r",encoding="utf-8") as file:
a=file.readlines()
for i in a:
......@@ -5,4 +6,9 @@ with open(r"c:\Users\8\Documents\lesson13-3\sales_list.txt","r",encoding="utf-8"
sum=0
for j in data[1:]:
sum+=int(j)
print(data[0]+str(sum))
\ No newline at end of file
print(data[0]+str(sum))
ex=data[0]+str(sum)+"\n"
sb.append(ex)
with open(r"c:\Users\8\Desktop\小组数据.txt","w",encoding="utf-8") as file1:
b=file1.writelines(sb)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment