zoukankan      html  css  js  c++  java
  • 判断操作系统的三种方法

    判断操作系统的三种方法:
    1. sys.platform
     Windows操作系统:
     >>> sys.platform
     'win32'
     
     Linux操作系统:
     >>> sys.platform
     'linux'
     
    2. os.name
     它的返回值有两种: nt 和 posix 。
     其中, nt 表示Windwos系操作系统, posix 代表类Unix或OS X系统
     
     Windows操作系统:
     >>> os.name
     'nt'
     
     Linux操作系统:
     >>> os.name
     'posix'
     
     
    3. platform模块:
     Windows操作系统:
     >>> platform.system()
     'Windows'
     >>> platform.release()
     '10'
     >>> platform.version()
     '10.0.17134'
     >>> platform.machine()
     'AMD64'
     >>> platform.uname()
     uname_result(system='Windows', node='DESKTOP-LBNGUN5', release='10', version='10.0.17134', machine='AMD64', processor='Intel64 Family 6 Model 142 Stepping 10, GenuineIntel')
     >>>
     
     Linux操作系统:
     >>> platform.system()
     'Linux'
     >>> platform.release()
     '3.10.0-693.21.1.el7.x86_64'
     >>> platform.version()
     '#1 SMP Wed Mar 7 19:03:37 UTC 2018'
     >>> platform.machine()
     'x86_64'
     >>> platform.uname()
     uname_result(system='Linux', node='localhost.localdomain', release='3.10.0-693.21.1.el7.x86_64', version='#1 SMP Wed Mar 7 19:03:37 UTC 2018', machine='x86_64', processor='x86_64')
     >>>
  • 相关阅读:
    事件模型
    用jQ实现一个简易计算器
    自学如何去学习jQuery
    用原生的javascript 实现一个无限滚动的轮播图
    Android 代码注解初学者
    安卓实现textView次行缩进效果
    安卓 checkBox添加左边距
    安卓 垂直SeekBar
    安卓 API 19 低版本设置单选按钮替换
    安卓BLE测试apk
  • 原文地址:https://www.cnblogs.com/brace2011/p/9291610.html
Copyright © 2011-2022 走看看