Commit d4b15afc by BellCodeEditor

save project

parent 2faf6422
Showing with 16 additions and 0 deletions
s = "C:\\Users\\Administrator\\Documents\\lesson13-1\\sales_list.txt"
with open(s,"r",encoding="utf-8")as f:#as,进一个文件
list_1 = f.readlines()
list_2 = []
for i in list_1:
list_2 = i.split()
print(list_2[0])
sum = 0
t = len(list_2)
q = 1
while q < t:
sum += int(list_2 [q])
q += 1
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