#!/usr/bin/env python # encoding: utf-8 # 查看主机名 import socket def gethostname(): hostname = socket.gethostname() return hostname ret = gethostname() print(ret)