471,091 Members | 1,598 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,091 software developers and data experts.

Execute Command and write in variable

Hello

How can I execute a command (like "uptime") in python, and write the
output into a variable?

Thanks
Jul 18 '05 #1
1 1215
tobias <to****@topi.homelinux.org> wrote:
Hello

How can I execute a command (like "uptime") in python, and write the
output into a variable?


import os

avariable = os.popen('uptime').read()
Alex
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Bob Garbados | last post: by
1 post views Thread by PJ | last post: by
4 posts views Thread by Chris | last post: by
4 posts views Thread by alberto | last post: by
3 posts views Thread by Rahul Babbar | last post: by
6 posts views Thread by Oliver | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.