confusing behaviour of os.system

Todd goldfita at signalsguru.net
Thu Apr 6 22:48:50 EDT 2006


Ben Cartwright wrote:
> Todd wrote:
> > I'm trying to run the following in python.
> >
> > os.system('/usr/bin/gnuclient -batch -l htmlize -eval "(htmlize-file
> > \"test.c\")"')
>
> Python is interpreting the \"s as "s before it's being passed to
> os.system.  Try doubling the backslashes.
>
> >>> print '/usr/bin/gnuclient -batch -l htmlize -eval "(htmlize-file> \"test.c\")"'
> /usr/bin/gnuclient -batch -l htmlize -eval "(htmlize-file> "test.c")"
> >>> print '/usr/bin/gnuclient -batch -l htmlize -eval "(htmlize-file> \\"test.c\\")"'
> /usr/bin/gnuclient -batch -l htmlize -eval "(htmlize-file> \"test.c\")"
> 
> --Ben

Thanks!  Yay multiple layers of string interpretation.




More information about the Python-list mailing list