Newbie question re: regsub

Robert Goto rgoto at aa.net
Sun Jul 2 19:30:40 EDT 2000


What is even more maddening to me is that when I save it to a module and run
it from NT command prompt......the output I get is the original file
contents only........like there was no regsub.gsub!!
"Robert Goto" <rgoto at aa.net> wrote in message
news:395fc90a$1_1 at huge.aa.net...
> 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