Advertisement
rfmonk

get_machine_info.py

May 5th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. #! /usr/bin/env python
  2. import socket
  3.  
  4. def print_machine_info():
  5.     host_name = socket.gethostname()
  6.     ip_address = socket.gethostbyname(host_name)
  7.     print "Host name: %s" % host_name
  8.     print "IP address: %s" % ip_address
  9.  
  10. if __name__ == '__main__':
  11.     print_machine_info()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement