Created
March 4, 2019 05:26
-
-
Save p208p2002/a68cba6a55131ceac78cc8c298b894ba to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket #引入lib | |
| def print_machine_info(): #自訂副程式 | |
| host_name = socket.gethostname() | |
| ip_address = socket.gethostbyname(host_name) | |
| print("Host name: %s" %host_name) | |
| print("IP address: %s" %ip_address) | |
| if __name__ == '__main__': #main函式 | |
| print_machine_info() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment