[Tutor] help:find a string in a text and replace it with a another string

mastjeptor regli mjeptcer at gmail.com
Wed Mar 7 18:33:46 CET 2007


Hi,folks.
     At first ,I have a question that I want to ask for help,it is how can I
search a specific string in a text (such a in a word document) and replace
it with another string?
     Second,if the text is changed dynamicly,can I use a variable string(has
been assigned a string) to search in the text and replace it with another
variable string.for example, *Regex Substitution:* s/email/e-mail ,if  the
string of "email" and "e-mail" are both changed from time to time,can we
apply
variable string (which has been assigned a value of string type) instead of
constant string of "email" and "e-mail" to construct a regex substitution
expression ?
      Please reply with experience in using  regular expression or python
library functions to find and replace a string in a text to help me.   Thank
you for your attention.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070308/df127917/attachment.html 


More information about the Tutor mailing list