[Tutor] Raw string

Monika Jisswel monjissvel at googlemail.com
Mon Jul 21 12:23:01 CEST 2008


>
> Thanks,
> I am aware of goodies that raw string offers, but my question was how to
> use it with variable that already contains string.  :)
>


if you are reading the value from a file :

import re
for line in myfile:
    if re.search(r'e:\mm tests\1. exp files\5.MOC-1012.exp', line):
        line = r'e:\mm tests\1. exp files\5.MOC-1012.exp'.replace('\\',
'\\\\')
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080721/de9c681c/attachment.htm>


More information about the Tutor mailing list