EOL - scanning single-quoted string

Mike Andrzejewski mandrzejewski at besancon.parkeon.com
Wed Aug 4 09:29:00 EDT 2004


Here, you should double the '\' character, but it also raise an error:
"bogus escape (end of line)"
You can try:
    re.subn('/', '\\\\', str)
The result string will be "\\My Documents\\test", and '\' will be usable
for next call.

Le mer 04/08/2004 à 15:20, Ajay a écrit :

> hi!
> 
> I am developing an application for a pocket pc.
> i have a small gui which allows users to select files using a file dialog
> box. however the file, selected is represented as '/My Documents/test'
> which when i try to open gives me an error.
> so what i would like to do is replace '/' by the windows '\'
> however when i try
> str='/My Documents/test'
> re.subn('/', '\', str)
> 
> i get an error saying - SyntaxError: EOL while scanning single-quoted
> string
> 
> how can i replace the slashes.
> 
> thanks
> 
> cheers
> 
> --
> Ajay Brar,
> CS Honours 2004
> Smart Internet Technology Research Group
> 
> 
> 
> 
> 
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040804/63ab6cfb/attachment.html>


More information about the Python-list mailing list