with open('..test.txt', 'w') as w:
w.write('hello, world, this my first Python text template. So excited that I made it!!!!I will keep working on this')
with open('..test.txt', 'r') as w1:
s = w1.readlines()
with open('..test.txt', 'w') as w2:
for i in s:
w2.write(i.replace("I", "Yourname",2))
with open('..test.txt', 'a') as w3:
w3.write(' 好好学习')
罗田心Livia
with open('..test.txt', 'w') as w: w.write('hello, world, this my first Python text template. So excited that I made it!!!!I will keep working on this') with open('..test.txt', 'r') as w1: s = w1.readlines() with open('..test.txt', 'w') as w2: for i in s: w2.write(i.replace("I", "Yourname",2)) with open('..test.txt', 'a') as w3: w3.write(' 好好学习')
#桌面就自动生成 一个 test.txt的文件了
#哪个大神知道 如何把单词中带有i 字母的全部替换为其他单词?