Commit 45cb1519 by BellCodeEditor

save project

parent 47d1db5c
Showing with 10 additions and 7 deletions
ith open(r"c:\Users\欧阳嘉锐\Documents\lesson13-3\sales_list.txt","r",encoding="utf-8") as file: with open(r"c:\Users\欧阳嘉锐\Documents\lesson13-3\sales_list.txt","r",encoding="utf-8") as file:
str=file.readlines() str=file.readlines()
a = []
for data in str: for data in str:
new_data=data.split() new_data=data.split()
sum=0 sum=0
for i in new_data[1:] for i in new_data[1:]:
sum += int(i) sum += int(i)
new_str=str(new_data[0]) result = new_data[0] + str(sum)
print(type(new_str[0])) a.append(result)
#print(new_data[0]) print(result)
#print(new_data[1:])
\ No newline at end of file with open(r"c:\Users\欧阳嘉锐\Documents\lesson13-3\sales_list.txt","a",encoding="utf-8") as file:
\ 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