capturing output of os.system() into a list?

Ron ron.l.johnson at home.com
Wed Dec 12 22:36:35 EST 2001


Richard Jones wrote:
> On Thursday 13 December 2001 12:06 pm, Ron wrote:
>> Is there a built-in method of doing this?  I can write a function
>> to do it, but would rather use the standard method.
> 
> something like:
> 
>>>> import os
>>>> os.popen('ls').readlines()
> ['addDataManager.dtml\n', 'addExtDataContainer.dtml\n',
[snip]
> 'VERSION.txt\n', 'www\n']

Thanks to both of you.  

I knew there had to be something.  It's just that there's *so 
many* libraries that us hobbiests (and who aren't C/Unix weenies) 
don't have a chance to learn it all.

-- 
+------------------------------------------------------------+
| Ron Johnson, Jr.        Home: ron.l.johnson at home.com       |
| Jefferson, LA  USA      http://ronandheather.dhs.org       |
|                                                            |
! Thanks to the good people in Microsoft, a great deal of    |
! the data that flows is dependent on one company. That is   |
! not a healthy ecosystem. The issue is that creativity gets |
! filtered through the business plan of one company.         |
!   Mitchell Baker, "Chief Lizard Wrangler" at Mozilla       |
+------------------------------------------------------------+



More information about the Python-list mailing list