Commit f5c745af by BellCodeEditor

save project

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