Commit 16d7509d by BellCodeEditor

save project

parent b8427c66
Showing with 18 additions and 0 deletions
a=["你好\n","悟空\n","我在贝尔学习python\n"]
with open(r'c:\Users\toshi\Desktop\hello.txt',"a",encoding="utf-8") as file:
file.writelines(a)
\ No newline at end of file
fill=open(r'c:\Users\toshi\Desktop\sales_list.txt',"r",encoding="utf-8")
a=fill.readlines()
fill.close()
final_sum=[]
for i in a:
list=i.split()
sum=0
for date in list[1:]:
sum=sum+int(date)
rs=list[0]+str(sum)
final_sum.append(rs)
print(rs)
with open(r'c:\Users\toshi\Desktop\new_list.txt',"a",encoding="utf-8") as file:
file.writelines(final_sum)
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