Commit 5bccabdc by BellCodeEditor

save project

parent 5eab7224
Showing with 3 additions and 3 deletions
...@@ -9,8 +9,8 @@ for i in a: #用for...in...把每一行的数据遍历 ...@@ -9,8 +9,8 @@ for i in a: #用for...in...把每一行的数据遍历
sum=sum+int(sales)#然后依次加起来,但sales是字符串,所以要转换 sum=sum+int(sales)#然后依次加起来,但sales是字符串,所以要转换
result = data[0]+str(sum)+'\n' #结果就是学生姓名和总义卖款 result = data[0]+str(sum)+'\n' #结果就是学生姓名和总义卖款
b.append(result) b.append(result)
print(b) #打印看看 # print(b) #打印看看
with open(r'D:\陈铭祺\sales_list.txt','r',encoding='utf-8') as file: with open(r'D:\陈铭祺\sales_list.txt','a',encoding='utf-8') as file:
a=file.readlines(b) a=file.weitelines(b)
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