Commit e54ee487 by BellCodeEditor

save project

parent 513e02d1
Showing with 8 additions and 7 deletions
with open(r'c:\Users\刘释远\Documents\lesson13-1\sales_list.txt','r',encoding='utf_8')as h: with open(r'c:\Users\刘释远\Documents\lesson13-1\sales_list.txt','r',encoding='utf_8')as h: #打开文件
a=h.readlines() a=h.readlines() #读多行
for i in a: for i in a:
wc=i.split() wc=i.split() #将i转为以间隔为分隔元素 成列表
w=wc[1:] w=wc[1:] #去掉第一个元素
sum=0 sum=0 #和
for y in w: for y in w:
# print(y) # print(y)
sum=sum+int(y) sum=sum+int(y)
print(sum) print(sum)
\ 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