[Tutor] simple text replace

2009-07-26 Thread j booth
Hello, I am scanning a text file and replacing words with alternatives. My difficulty is that all occurrences are replaced (even if they are part of another word!).. This is an example of what I have been using: for line in fileinput.FileInput("test_file.txt",inplace=1): > line = lin

Re: [Tutor] simple text replace

2009-07-26 Thread j booth
oops, I mean that the script opens a file and splits it into words; Then it takes each word and searches for an alternative online; with the alternative now stored in a variable, it simply needs to be written back over the original word in the same file. at the moment this might solve the problem,

[Tutor] word replace

2009-08-30 Thread j booth
Hello, I have been experiencing such difficulty with something that should be easy-- pretty new to programming.. Need to: (1) open a text file (2) iterate through it word by word (3) replace each word with an alternative word and close the file. **I don't know what the alternative word will be b