shell access

Tim Chase python.list at
Mon Jan 11 23:42:39 CET 2010

monkeys paw wrote:
> How do you access the command line from the
> python interpreter?
> on unix:
> type python
>  >>> print 'hey'
> 'hey'
>  >>>   # I want to access the shell here, how do i do that?

If you're interactive, I'd just use standard process/job control, 
and hit control+Z to suspend and "fg" to resume:

   tim at rubbish:~$ python
   Python 2.5.4 (r254:67916, Nov 19 2009, 19:46:21)
   [GCC 4.3.4] on linux2
   Type "help", "copyright", "credits" or "license" for more 
   >>> print 'hello'
   >>> # (hitting ^Z here instead of typing this command)
   [1]+  Stopped                 python
   tim at rubbish:~$ ls tmp/[xyz]*.py
   tmp/  tmp/
   tim at rubbish:~$ fg
   print 'world'
   print 'world'


More information about the Python-list mailing list