On Mon, 13 Nov 2006 17:13:25 +0200
"Matt Erasmus" <[EMAIL PROTECTED]> wrote:

> Hi guys
> 
> Very new to python programming but am really enjoying it.
> 
> Anyway, I was just wondering if this code could be improved on in anway.
> 
> ...
> stdin, stdout, stderr = os.popen3('/bin/hostname -f')
> system_name = stdout.read()
> stdin.close()
> stderr.close()
> stdout.close()
> ...
> report.write("System Report for: ")
> report.write(system_name)
> ...
> 
> Is there a better way of doing this ? It works for what I want to do,
> but I would
> like to know if there's another way of doing things....
> 

import socket
print socket.gethostname()

I hope this helps

Michael

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to