无法成功替换
运行结果
line.replace('Python', '12')修改为line = line.replace('Python', '12')
采纳
line.replace() 并不改变line本身的值。可以赋值给新的变量,或者直接print(line.replace('Python','12').rstrip())
rsttrip()赋值变量