Get the hostname

paul.baines at paul.baines at
Wed Aug 6 13:29:20 CEST 2003

I do this on AIX:

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


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

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')

Lukas Schnieper


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