Commit 24b78fad by BellCodeEditor

save project

parent f7dfb9c2
Showing with 12 additions and 2 deletions
aa=['你好啊\n','悟空\n','我在贝尔编程程学python\n']
with open(r'c:\Users\Administrator\Desktop\helloworld.text.txt',"a",encoding="utf-8")as file:
file.writelines(aa)
\ No newline at end of file
with open(r'c:\Users\Administrator\Desktop\ljw.text.txt',"r",encoding="utf-8")as file:
a=file.readlines()
#print(a)
helloja=[]
for i in a:
data=i.split()
#print(data[0])
#print(data[1:])
num=0
for sales in data[1:]:
num=num+int(sales)
hi=data[0]+str(num)
print(hi)
hi=data[0]+str(num)+"\n"
helloja.append(hi)
with open(r'c:\Users\Administrator\Desktop\helloworld.text.txt',"w",encoding="utf-8")as file:
file.writelines(helloja)
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