without shell

Mage mage at mage.hu
Fri Jun 10 10:20:38 EDT 2005


Steven D'Aprano wrote:

>On Sun, 12 Jun 2005 23:16:35 +0530, km wrote:
>
>  
>
>>hi all,
>>
>>can any linux command be invoked/  executed without using shell (bash) ?
>>    
>>
>
>py> import os
>py> status = os.system("ls")
>
>Prints the output of ls and stores the exit code into status.
>
>py> file_list = os.popen("ls").read()
>
>Stores the output of ls into file_list.
>
>  
>
These commands invoke shell indeed.

       Mage




More information about the Python-list mailing list