Commit 4848f268 by BellCodeEditor

save project

parent 1e9a4af4
Showing with 7 additions and 3 deletions
with open(r"C:\Users\86185\Desktop\Python文件\money.txt",'r',encoding='UTF-8') as f: with open(r"C:\Users\86185\Desktop\Python文件\money.txt",'r',encoding='UTF-8') as f:
r=f.readlines() r=f.readlines()
with open(r"C:\Users\86185\Desktop\Python文件\money.txt",'w',encoding='UTF-8') as f:
f.write("")
for i in r: for i in r:
a=i.split() a=i.split()
# print("姓名:"+i[0:2]) # print("姓名:"+i[0:2])
# print("收获:"+i[1:]) # print("收获:"+i[1:])
print(a)
b=0 b=0
d=""
for h in a[1:]: for h in a[1:]:
b=b+int(h) b=b+int(h)
c=a[0]+str(b) c=a[0]+str(b)
print(c) print(c)
\ No newline at end of file with open(r"C:\Users\86185\Desktop\Python文件\money.txt",'a',encoding='UTF-8') as f:
f.write(c+"\n")
\ 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