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

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Jul 28 16:49:53 EDT 2009


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?
> 
> 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 
 >>>) type whatever commands you wish, e.g.

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.
 >>> import re
 >>> help(re.compile)
Help on function compile in module re:

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

 >>>

-- 
Kindest regards.

Mark Lawrence.




More information about the Python-list mailing list