from : Micro reading https://www.weidianyuedu.com
python learning platform modular
This module is used to access platform related properties .
Common properties and methods
The platform architecture
platform.machine()
Return to platform architecture . If you can't be sure , Returns an empty string .
1
2
3
4
5
>>> platform.machine()
"AMD64"
>>> platform.machine()
"x86_64"
Network name ( Host name )
platform.node()
Returns the network name of the computer ( May not be fully qualified !). If the value cannot be determined , Returns an empty string .
1
2
3
4
5
6
7
#windows
>>> platform.node()
"office"
#linux
>>> platform.node()
"abcxx"
System version
platform.platform(aliased = 0,terse = 0)
If aliased by True, Then the function will use aliases of different platforms to report system names different from their common names , for example SunOS Will be reported as Solaris. system_alias() The function is used to implement .
take terse Set to True This will cause the function to return only the absolute minimum information required to identify the platform .
1
2
3
4
5
6
7
8
9
10
11
12
>>> platform.platform()
"Windows-8.1-6.3.9600-SP0"
>>> platform.platform(aliased=True)
"Windows-8.1-6.3.9600-SP0"
>>> platform.platform(aliased=True,terse=True)
"Windows-8.1"
>>> platform.platform(aliased=True,terse=False)
"Windows-8.1-6.3.9600-SP0"
#linux
>>> platform.platform()
"Linux-2.6.32-642.13.1.el6.x86_64-x86_64-with-centos-6.8-Final"
Processor name
platform.processor()
Return processor name .
1
2
3
4
5
6
>>> platform.processor()
"Intel64 Family 6 Model 60 Stepping 3, GenuineIntel"
#linux
>>> platform.processor()
"x86_64"
System name
platform.system()
Back to the system / Operating system name , for example “Linux”,“Windows” or “Java”. If the value cannot be determined , Returns an empty string .
1
2
3
4
5
6
>>> platform.system()
"Windows"
#linux
>>> platform.system()
"Linux"