[Tutor] how to get variable from an external script or program

vince spicer vinces1979 at gmail.com
Fri May 29 23:37:15 CEST 2009


Sorry *output

import commands
> output = commands.getoutput("ls -lah")



> Vince
>
>
> On Fri, May 29, 2009 at 3:27 PM, shawn bright <nephish at gmail.com> wrote:
>
>> Hey all
>>
>> I have a small program that when run from the command line, will
>> return a certain value for an arguement. Like this:
>>
>> > mfetchz 45
>> > 45j
>>
>> so the program is mfetchz and the argument is 45
>>
>> i know i can call the program with os.system("mfetchz 45")
>> but how do i get the return?
>>
>> The OS is linux, if that matters
>>
>> thanks
>>
>> sk
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> http://mail.python.org/mailman/listinfo/tutor
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090529/3447f89e/attachment.htm>


More information about the Tutor mailing list