Hi, there

Rafael Mentz Aquino rafael at zumnet.com.br
Tue Sep 4 15:35:29 EDT 2001


Thanks everybody. I received more than one solution, all working fine!

Just for the records, I'm using snmp to get information from a host,
and I 'm using ucd-snmp 'cause all implementations of that in Python
that I saw wasn't working yet.... (please correct me if i'm wrong...)

So I get a great result doing something like that...:

a=string.split(os.popen("ls").read(),"\n)

I know isn't the best way, but... hey, I'm a newbie ;-)

Thanks again...

Rafael Aquino
Zumnet Provider
Porto Alegre - Brazil


Andrew Gould wrote:

> Have you tried os.popen instead?  For example:
>
> a = os.popen('ls').readlines()
>
> will execute ls and assign the results to the variable a.
>
> I hope this helps.
>
> Andrew
>
> > ----------
> > From:         Rafael Mentz Aquino[SMTP:rafael at zumnet.com.br]
> > Sent:         Tuesday, September 04, 2001 10:14 AM
> > To:   python-list at python.org
> > Subject:      Hi, there
> >
> > Hi, everybody! I'm new on this list and a begginer with Python,
> > with special interests in Tkinter.
> >
> > I hope I can help and get help from here ;-)
> >
> > Let me start with a little problem...?
> >
> > I'm making an experience, but I can't  put the result of an os.system
> > to a variable.... just the exit status....
> >
> > How can I read the stdout to solve that..?
> >
> > Thanks already!!!!
> >
> > Rafael Mentz Aquino
> > Porto Alegre - Brazil
> >
> >
> > --
> > http://mail.python.org/mailman/listinfo/python-list
> >
>
> --
> http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list