Get the hostname

paul.baines at ecb.int paul.baines at ecb.int
Wed Aug 6 07:29:20 EDT 2003


I do this on AIX:

import commands
hostname=commands.getoutput("uname -n")

Paul.

-----Original Message-----
From: Lukas Schnieper [mailto:schnieper at semafor.ch]
Sent: 06 August 2003 13:23
To: python-list at python.org
Subject: Get the hostname


Hi
How can i get the hostname of my Linux PC?
I tried os.system('hostname') but i cant save the hostname in a variable 
  like hostname = os.system('hostname')

thanks
Lukas Schnieper


-- 
http://mail.python.org/mailman/listinfo/python-list

Any e-mail message from the European Central Bank (ECB) is sent in good faith but shall neither be binding nor construed as constituting a commitment by the ECB except where provided for in a written agreement.
This e-mail is intended only for the use of the recipient(s) named above. Any unauthorised disclosure, use or dissemination, either in whole or in part, is prohibited.
If you have received this e-mail in error, please notify the sender immediately via e-mail and delete this e-mail from your system.






More information about the Python-list mailing list