Newbie question re: regsub

Robert Goto rgoto at aa.net
Sun Jul 2 19:16:12 EDT 2000


I am sure there is a very simple answer to this.
>>> import regsub
>>> fimo = open('fimo.txt')
>>> while 1:
 line = fimo.readline()
 if not line: break
 regsub.gsub('orange', 'red', line)
 print line


'red red red red red red red'
red orange red red red red red
>>>

The file I am opening which is called fimo.txt only contains the string
withouth ' marks  red orange red red red red red.

What I want it to do is print the changed string  only....but what I am
getting is both the original string and the changed string?!

Any pointers would be greatly appreciated.





More information about the Python-list mailing list