From Python to Shell

Fredrik Lundh fredrik at
Thu Jun 8 16:28:49 CEST 2006

NightHawk wrote:

> Im not a total noob but i don't know the command and the module to go
> from python to the default shell.

I'm not sure what you mean by "go to", but if you want to start an 
interactive OS shell from inside Python, you can do:

	>>> import os
	>>> os.system(os.environ["SHELL"])

on Unix, and

	>>> import os
	>>> os.system(os.environ["comspec"])

on Windows.


More information about the Python-list mailing list