Commit f41e50c2 by BellCodeEditor

save project

parent 2de884ac
Showing with 10 additions and 1 deletions
with open(r"c:\Users\bellcode\Documents\lesson13-1\sales_list.txt ","r",encoding="utf-8")as life:
a=life.readlines()
hehehe=[]
for i in a:
data=i.split()
sum=0
for ys in data[1:]:
sum=sum+int(ys)
hhh=data[0]+str(sum)
hhh=data[0]+str(sum)+'\n'
hehehe.append(hhh)
print(hhh)
with open(r"C:\Users\bellcode\Desktop\hello.txt ","a",encoding="utf-8")as life:
life.writelines(hehehe)
\ No newline at end of file
a=['你好,悟空\n','我在python']
with open(r"C:\Users\bellcode\Desktop\hello.txt ","a",encoding="utf-8")as life:
life.writelines(a)
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