Raw Strings (I Think)
gagsl-py2 at yahoo.com.ar
Mon Jul 28 13:05:48 CEST 2008
En Thu, 24 Jul 2008 12:02:00 -0300, Lanny <lanny at freshells.ch> escribió:
> I've used glob.glob to get a list of files in a directory
> and now I want to use os.system to execute one of
> those files, the problem is that python automatically
> puts a escape charater infront of the back slashes
> so the os.system gets X:\\####\\####\\ and is useless,
> I think I need to convert my string to a raw string but
> I don't know how.
Those \\ represent a SINGLE character. That is, they LOOK duplicated in code and when you use repr(...) but it's actually a single backslash:
>>> path = "X:\\abc"
>>> print path
Probably you have another issue - please post a short but complete failing code...
More information about the Python-list