Commit 7f1ae630 by BellCodeEditor

save project

parent c341ab5f
Showing with 7 additions and 4 deletions
with open(r'C:\Users\Lenovo\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as file1:
a=file1.readlines()
#print(a)
qwer=[]
for i in a:
data = i.split()
sum = 0
for setar in data[1:]:
sum = sum + int(setar)
asdf = data[0] + str(sum)
print(asdf)
\ No newline at end of file
asdf = data[0] + str(sum)+'\n'
qwer.append(asdf)
with open(r'C:\Users\Lenovo\Desktop\新建文件夹.txt','a',encoding='utf-8') as file:
file.writelines(qwer)
\ 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