Differences between revisions 5 and 6
Revision 5 as of 2008-07-15 18:39:51
Size: 474
Editor: 66
Comment:
Revision 6 as of 2008-11-15 14:01:26
Size: 474
Editor: localhost
Comment: converted to 1.6 markup
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
This is a simple ["Powerful Python One-Liners"]. It prints the systems's hostname to the screen. This is a simple [[Powerful Python One-Liners]]. It prints the systems's hostname to the screen.
Line 14: Line 14:
["lwickjr"]: --which doesn`t seem to work on Windows. :( [[lwickjr]]: --which doesn`t seem to work on Windows. :(

Description

This is a simple Powerful Python One-Liners. It prints the systems's hostname to the screen.

Code

from socket import gethostname; print gethostname()

Download

This program has been uploaded to the Wiki. You can download it as an attachment from this page.

Well, sometimes. A lighter-weight variant with desirable properties is

import os; print os.uname()[1]

lwickjr: --which doesn`t seem to work on Windows. :(

Powerful Python One-Liners/Hostname (last edited 2009-03-07 22:21:04 by adsl-75-30-178-145)

Unable to edit the page? See the FrontPage for instructions.