Commit 34af3ec3 by BellCodeEditor

save project

parent f2ed7349
Showing with 6 additions and 3 deletions
with open(r'D:\郭涵哲\sales_list.txt','r',encoding='utf-8') as file1:
a=file1.readlines()
x=[]
for i in a:
data=i.split()
sum=0
for m in data[1:]:
sum+=int(m)
result=data[0]+str(sum)
print(result)
\ No newline at end of file
result=data[0]+str(sum)+'\n'
x.append(result)
with open(r'D:\郭涵哲\sales_list.txt','a',encoding='utf-8') as y:
y.writelines(x)
\ No newline at end of file
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