Jump to content

Host introspection: Difference between revisions

→‎{{header|Python}}: Use the built-in platform module instead.
(→‎{{header|Python}}: Use the built-in platform module instead.)
Line 798:
 
=={{header|Python}}==
<lang python>>>> import platform, sys, mathsocket
>>> platform.architecture()
>>> int(round(math.log(sys.maxint,2)+1)) # this only works in Python 2.x
('64bit', 'ELF')
32
>>> platform.machine()
>>> import struct
'x86_64'
>>> struct.calcsize('i') * 8
>>> platform.node()
32
'yourhostname'
>>> platform.system()
'Linux'
>>> sys.byteorder
little
>>> import socket
>>> socket.gethostname()
'yourhostname'
'PADDY3118-RESTING'
>>></lang>
 
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.