Need help in passing a "-c command" argument to the interactive shell.

Philip Semanchuk philip at semanchuk.com
Tue Jul 28 16:45:08 EDT 2009


On Jul 28, 2009, at 4:16 PM, Bill wrote:

> On my windows box I type => c:\x>python -c "import re"
>
> The result is => c:\x>
>
> In other words, the Python interactive shell doesn't even open. What
> am I doing wrong?

Nothing! =) The -c option tells Python to execute the commands in the  
quotes as a Python program. It's as if you wrote a Python program that  
contained only "import re" and then executed that program.

If you want to run the Python interpreter interactively, just type  
"python" (no quotes) at the command prompt and hit enter.


> I did RTFM at http://www.python.org/doc/1.5.2p2/tut/node4.html on
> argument passing, but to no avail.

Yikes, that's the documentation for Python 1.5.2 which is nine years  
old! If that's the version you're running, then it's appropriate to  
read that documentation, but that's probably not the case.

"python --version" (again, no quotes) should tell you what version  
you're running.

HTH
Philip




More information about the Python-list mailing list