[Tutor] Raw string
Monika Jisswel
monjissvel at googlemail.com
Mon Jul 21 14:18:54 CEST 2008
>
> I don't know in advance what the file name will be...
import re
for line in myfile:
if re.search(r'\', line):
line = line.replace('\\', '\\\\')
if you have lines that contain a \ in them that you don't want to substitute
then you need another if statement.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20080721/2204fe5e/attachment.htm>
More information about the Tutor
mailing list