Commit a5514d1c by BellCodeEditor

save project

parent 499f937a
a=['你好呀\n','悟空\n','我在贝尔编程学Python\n']
with open(r'\Users\Administrator\Documents\lesson13-1\Hello.txt','w',encoding='utf-8') as gfs:
gfs.writelines(a)
\ No newline at end of file
你好呀
悟空
我在贝尔编程学Python
with open(r'\Users\Administrator\Documents\lesson13-1\sales_list.txt','r',encoding='utf-8') as gfs:
a=gfs.readlines()
ds=[]
for i in a:
po=i.split()
sum=0
for j in po[1:]:
sum=sum+int(j)
l=po[0]+str(sum)
print(l)
\ No newline at end of file
l=po[0]+str(sum)+'\n'
ds.append(l)
with open(r'\Users\Administrator\Documents\lesson13-1\new_salelist.txt','a',encoding='utf-8') as gfs:
gfs.writelines(ds)
\ No newline at end of file
诺依380
小贝182
李丽201
宋扬107
王明245
李强164
孙小白222
苏琪137
刘若若147
刘阳226
王胜男123
王娇131悟空348
诺依380
小贝182
李丽201
宋扬107
王明245
李强164
孙小白222
苏琪137
刘若若147
刘阳226
王胜男123
王娇131
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