I am using the following code to upload a file on server using FTP after editing it:
import fileinput
file = open(\'example.php\',\'rb+\')
for line in file
The second error is how the replace() method works.
It returns the entire input string, with only the specified substring replaced. See example here.
To write to a specific place in the file, you should seek() to the right position first.
I think this issue has been asked before in several places, I would do a quick search of StackOverflow.
Maybe this would help?