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

P

Philip Semanchuk

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
 
M

Mark Lawrence

Bill said:
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?

I did RTFM at http://www.python.org/doc/1.5.2p2/tut/node4.html on
argument passing, but to no avail.
You've told python to run the command "import re" which it's happily
done before exiting. Simply type python, then at the prompt (default
c:\Users\Mark\python\regex>python
Python 2.6.2 (r262:71605, Apr 14 2009, 22:40:02) [MSC v.1500 32 bit
(Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.Help on function compile in module re:

compile(pattern, flags=0)
Compile a regular expression pattern, returning a pattern object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,190
Members
46,740
Latest member
AdolphBig6

Latest Threads

Top