Information for Authors resource now available
17 ปีที่ผ่านมา
import python for everyone in thailand: happycoding()
goodbye
hello
see you later!
import fileinput
for lines in fileinput.FileInput("inputfile.txt", inplace=1): ## edit file in place
lines = lines.replace("hello","hi")
print lines.replace('\n','') ## although this prints the line, the file will be modified.
goodbye
hi
see you later!