- 直接引入platform模块,全部方法如下:
import platform;
# ouput system type and version info
logging.info("platform.machine()=%s", platform.machine());
logging.info("platform.node()=%s", platform.node());
logging.info("platform.platform()=%s", platform.platform());
logging.info("platform.processor()=%s", platform.processor());
logging.info("platform.python_build()=%s", platform.python_build());
logging.info("platform.python_compiler()=%s", platform.python_compiler());
logging.info("platform.python_branch()=%s", platform.python_branch());
logging.info("platform.python_implementation()=%s", platform.python_implementation());
logging.info("platform.python_revision()=%s", platform.python_revision());
logging.info("platform.python_version()=%s", platform.python_version());
logging.info("platform.python_version_tuple()=%s", platform.python_version_tuple());
logging.info("platform.release()=%s", platform.release());
logging.info("platform.system()=%s", platform.system());
#logging.info("platform.system_alias()=%s", platform.system_alias());
logging.info("platform.version()=%s", platform.version());
logging.info("platform.uname()=%s", platform.uname());
-
输出结果:
LINE 1476 : INFO platform.machine()=AMD64 LINE 1477 : INFO platform.node()=PC-CLI-1 LINE 1478 : INFO platform.platform()=Windows-7-6.1.7601-SP1 LINE 1479 : INFO platform.processor()=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel LINE 1480 : INFO platform.python_build()=('default', 'Jun 12 2011 15:08:59') LINE 1481 : INFO platform.python_compiler()=MSC v.1500 32 bit (Intel) LINE 1482 : INFO platform.python_branch()= LINE 1483 : INFO platform.python_implementation()=CPython LINE 1484 : INFO platform.python_revision()= LINE 1485 : INFO platform.python_version()=2.7.2 LINE 1486 : INFO platform.python_version_tuple()=('2', '7', '2') LINE 1487 : INFO platform.release()=7 LINE 1488 : INFO platform.system()=Windows LINE 1490 : INFO platform.version()=6.1.7601 LINE 1491 : INFO platform.uname()=('Windows', 'PC-CLI-1', '7', '6.1.7601', 'AMD64', 'Intel64 Family 6 Model 42 Stepping 7, GenuineIntel')
-
一大堆的信息可以找根据自己的想法自由发挥了
网友评论