Commit 6b3425ec by BellCodeEditor

save project

parent 5ec53ebb
Showing with 69 additions and 2 deletions
for i in range(1000):
try:
file=open(r"C:\Users\Administrator\Documents\lesson13-1\sales_list.txt",'r',encoding='utf-8')
except:
print('open error')
exit()
lt=[]
name=[]
moeyy=[]
moeyy_list=[]
lt=file.readlines()
for i in lt:
temp=''
bianli=0
for i2 in i:
if i2==' ':
bianli+=1
break
temp=temp+i2
bianli+=1
name.append(temp)
temp=''
for i2 in range(bianli,len(i)):
if i[i2]==' ':
moeyy.append(temp)
temp=''
temp+=i[i2]
temp=0
for i2 in moeyy:
temp+=int(i2)
moeyy=[]
moeyy_list.append(temp)
for i in range(len(name)):
print(name[i],'捐款:',moeyy_list[i])
\ No newline at end of file
try:
file=open(r"C:\Users\Administrator\Documents\lesson13-1\sales_list.txt",'r',encoding='utf-8')
except:
print('open error')
exit()
lt_temp=[]
lt=[]
name=[]
moeyy=[]
moeyy_list=[]
lt_temp=file.readlines()
for i in lt_temp:
temp=[]
lt.append(i.split())
name.append(lt[0][0])
for i2 in lt[0][1:]:
moeyy.append(i2)
temp=0
for i3 in moeyy:
temp+=int(i3)
moeyy=[]
moeyy_list.append(temp)
lt.clear()
for i in range(len(name)):
print(name[i],'捐款:',moeyy_list[i])
\ No newline at end of file
......@@ -10,4 +10,4 @@
刘若若 11 11 13 11 20 15 13 29 24
刘阳 11 15 22 11 23 26 22 15 17 52 12
王胜男 27 15 15 26 13 12 15
王娇 12 11 12 12 15 35 23 11
\ No newline at end of file
王娇 12 11 12 12 15 35 23 11 6356346634638275438546523432746547357275462348723687435435227435274523754233547542375423
\ 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