Ver originalimport fileinputfor line in fileinput.FileInput("archivo",inplace=1): line = line.replace("palabra","palabra2") print line,