#_ *_ coding:utf-8 _*_
Import socket
import getpass
import platform
import uuid #通用唯一识别码
myname1=s Ocket.getfqdn (Socket.gethostname ())
#socket. GETFQDN (name) converts an IP address string that is separated by a dot number into a full domain name
#或者这样
myname2= Platform.uname () [1]
myaddr=socket.gethostbyname (myname1)
#socket. gethostbyname (hostname) Resolves the host name to a dot-delimited IP address string
user=getpass.getuser ()
#获得机器名
myarchitecture=platform.architecture ()
#返回系统架构信息, it doesn't seem to be accurate
myplatform=platform.platform ()
mac=uuid. UUID (Int=uuid.getnode ())
mac=mac.hex[-12:]
print myname1
print myname2
print myaddr
Print user
print myarchitecture
print myplatform
print MAC
Output:
>>>
PC201401131620
PC201401131620
169.254.196.106
Administrator
(' 32bit ', ' WindowsPE ')
windows-7-6.1.7601-sp1
0cd2928db52a
Feel that the return schema information is not accurate
My computer is 64-bit.
These feel python powerful, get IP two rows OK, far from c comparable, although there is nothing comparable haha: blame me not deep into C-. -。