Python is removing my quotes!

Gary Herron gherron at islandtraining.com
Tue Aug 21 12:09:13 EDT 2007


Robert Dailey wrote:
> Hi,
>
> Note: I'm using Python on Windows
>
> I have an application that allows a user to submit a password as a
> command line parameter. The password of choice may contain any
> characters the user wishes, including quotes. If I do the following:
>
> python password.py "9999"MyPassword
>
> The resulting output when I print this inside the script is:
>
> 9999MyPassword
>
> Notice how the quotations have been stripped. Is it DOS doing this, or
> Python? Is there a way I can fix it?
>
> Thanks.

Not Python.  It never even sees those quotes.  Whatever system you are
using for entering the text is stripping them.  Is it the command prompt
(cmd.exe)?  If so then you can escape the quote by preceding it with a
backslash.  (This is true of the DOS prompt and all the unix shells, and
their windows ports, that I know about.)

Gary Herron




More information about the Python-list mailing list