Commit 246c15ee by BellCodeEditor

save project

parent e643b17b
Showing with 6 additions and 18 deletions
file=open(r'c:\Users\刁敬凯\Documents\lesson13-3\sales_list.txt','r',encoding='utf-8')
a=file.readlines()
print(a)
f=[]
for i in a:
# print(i)
p=i.split()
#print(p[1:])
sum=0
s=''
for sa in p[1:]:
sum+=int(sa)
s=p[0]+str(sum)+'\n'
print(s)
f.append(s)
import turtle
pen=turtle.Pen()
pen.write("诺依,你好呀\n" "turtle真好用",font=("Times",30,"normal"))
pen.hideturtle()
turtle.done()
#print(f)#file.close() # print(f)
with open(r'c:\Users\刁敬凯\Desktop\a.txt','w',encoding='utf-8')as file1:
file1.writelines(f)
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