Commit cd2722e1 by BellCodeEditor

save project

parent 02be4f46
Showing with 7 additions and 3 deletions
with open(r'C:\Users\gzs\Desktop\sales_list.txt')as file:
resulit=[]
with open(r'C:\Users\gzs\Desktop\sales_list.txt','r',encoding='utf-8')as file:
for line in file.readlines():
li=line.split()
name=li[0]
......@@ -6,4 +7,7 @@ with open(r'C:\Users\gzs\Desktop\sales_list.txt')as file:
sum=0
for num in nums:
sum=sum+int(num)
print(f'{name}{sum}')
\ No newline at end of file
#print(f'{name}{sum}')
result.append(f'{name} {sum}\n')
with open(r'C:\Users\gzs\Desktop\sales_list_sum.txt','w',encoding='utf-8')as file1:
file1.writelines(result)
\ 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