python检测当前系统

直接上代码吧:

>>> import os
>>> os.name
‘nt’
>>> import platform
>>> platform.system()
‘Windows’

>>> platform.release()
‘XP’
>>> platform.version()
‘5.1.2600’
>>> platform.uname()
(‘Windows’, ‘hly’, ‘XP’, ‘5.1.2600’, ‘x86’, ‘x86 Family 6 Model 15 Stepping 2, G
enuineIntel’)

更详细的信息可参考:

http://docs.python.org/lib/node441.html

版权所有,禁止转载. 如需转载,请先征得博主的同意,并且表明文章出处,否则按侵权处理.

    分享到:

Leave a Reply

Your email address will not be published. Required fields are marked *