程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Platform module of Python language learning

編輯:Python

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"


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved