Commit f8b42c46 by BellCodeEditor

save project

parent a0fb368e
Showing with 13 additions and 2 deletions
...@@ -2,5 +2,14 @@ with open(r'c:\Users\DELL\Documents\lesson13-1\sales_list.txt','r',encoding='utf ...@@ -2,5 +2,14 @@ with open(r'c:\Users\DELL\Documents\lesson13-1\sales_list.txt','r',encoding='utf
#print(file) #print(file)
a = file.readlines() a = file.readlines()
#print(a) #print(a)
sum_1=[]
for i in a: for i in a:
print(i) #print(i)
\ No newline at end of file data = i.split()
sum=0
for j in data[1:]:
sum=sum+int(j)
list=data[0]+str(sum)
sum_1.append(list)
with open(r'c:\Users\DELL\Documents\lesson13-1\new_sales_list.txt','a',encoding='utf-8') as file:
file.writelines(list)
\ No newline at end of file
王娇131王娇131
\ 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