zoukankan      html  css  js  c++  java
  • python 判断操作系统类型

     1 #!/bin/python
     2 #
     3 import platform
     4 
     5 def TestPlatform():
     6     print ("----------Operation System--------------------------")
     7     #Windows will be : (32bit, WindowsPE)
     8     #Linux will be : (32bit, ELF)
     9     print(platform.architecture())
    10 
    11     #Windows will be : Windows-XP-5.1.2600-SP3 or Windows-post2008Server-6.1.7600
    12     #Linux will be : Linux-2.6.18-128.el5-i686-with-redhat-5.3-Final
    13     print(platform.platform())
    14 
    15     #Windows will be : Windows
    16     #Linux will be : Linux
    17     print(platform.system())
    18 
    19     print ("--------------Python Version-------------------------")
    20     #Windows and Linux will be : 3.1.1 or 3.1.3
    21     print(platform.python_version())
    22 
    23 def UsePlatform():
    24   sysstr = platform.system()
    25   if(sysstr =="Windows"):
    26     print ("Call Windows tasks")
    27   elif(sysstr == "Linux"):
    28     print ("Call Linux tasks")
    29   else:
    30     print ("Other System tasks")
    31 
    32 UsePlatform()
  • 相关阅读:
    c++ 虚继承与继承的差异 (转)
    主题:PageRank解释
    (转)开源爬虫larbin分析
    Django随笔
    原生爬虫小Demo
    SVN
    Python的正则表达式与JSON
    类库 方法 模块等
    笔记
    自动补全Typeahead
  • 原文地址:https://www.cnblogs.com/hushaojun/p/8985371.html
Copyright © 2011-2022 走看看