On Sun, 15 Dec 2013 18:43:53 -0800, Igor Korot <ikoro...@gmail.com> wrote:
On Sun, Dec 15, 2013 at 4:58 PM, MRAB <pyt...@mrabarnett.plus.com>
wrote:



> When writing paths on Windows, it's a good idea to use raw string
> literals or slashes instead of backslashes:
>
>     conn = sqlite3.connect(r'c:\Documents and
> Settings\Igor.FORDANWORK\Desktop\mydb.db', detect_types =
> sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)
>
> or:
>
>     conn = sqlite3.connect('c:/Documents and
> Settings/Igor.FORDANWORK/Desktop/mydb.db', detect_types =
> sqlite3.PARSE_DECLTYPES|sqlite3.PARSE_COLNAMES)

So, how do I convert my string to one of those?
I realized I can just do replace '/' to '\', but is there a better
alternative?

The "conversion" is done with a text editor. The string literals you had were just wrong. By the time they have been turned into strings it's too late to algorithmically recover your intended string values.

--
DaveA

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to