代码:

import platform

def TestPlatform():
print ("----------Operation System--------------------------")
#Windows will be : (32bit, WindowsPE)
#Linux will be : (32bit, ELF)
print(platform.architecture()) #Windows will be : Windows-XP-5.1.-SP3 or Windows-post2008Server-6.1.
#Linux will be : Linux-2.6.-.el5-i686-with-redhat-5.3-Final
print(platform.platform()) #Windows will be : Windows
#Linux will be : Linux
print(platform.system()) print ("--------------Python Version-------------------------")
#Windows and Linux will be : 3.1. or 3.1.
print(platform.python_version()) def UsePlatform():
sysstr = platform.system()
if(sysstr =="Windows"):
print ("Call Windows tasks")
elif(sysstr == "Linux"):
print ("Call Linux tasks")
else:
print ("Other System tasks") UsePlatform()

参考博客:原文链接http://www.cnblogs.com/snow-backup/p/4151276.html

import platform

def TestPlatform():
return platform.architecture()[] def mysubData(subData):
b = [] for i in subData:
try:
if numpy.isnan(i):
i = "Null"
b.append(i)
if TestPlatform() == "64bit":
if isinstance(i, numpy.float64):
b.append(i)
elif isinstance(i, numpy.int64):
b.append(i)
elif TestPlatform() == "32bit":
if isinstance(i, numpy.float32):
b.append(i)
elif isinstance(i, numpy.int32):
b.append(i)
except:
if isinstance(i, str):
if "'" in i:
i.replace("'", "")
elif "%" in i:
i.replace("'", "")
elif "\\" in i:
i.replace("'", "")
b.append(i)
else:
b.append(i) return b

Python判断操作系统类型的更多相关文章

  1. python 判断操作系统类型

    #!/bin/python # import platform def TestPlatform(): print ("----------Operation System--------- ...

  2. Java 判断操作系统类型(适用于各种操作系统)

    Java 判断操作系统类型(适用于各种操作系统) 最近一段时间写一个授权的程序,需要获取很多信息来保证程序不能随意复制使用,必须经过授权才可以. 为了限制用户使用的操作系统,必须有统一的方法来获取才可 ...

  3. python实例[判断操作系统类型]

    参考文献:http://bbs.chinaunix.net/thread-1848086-1-1.html 经常地我们需要编写跨平台的脚本,但是由于不同的平台的差异性,我们不得不获得当前所工作的平台( ...

  4. 深入C#判断操作系统类型的总结详解(转载)

    Windows操作系统的版本号一览 操作系统  PlatformID  主版本号  副版本号  Windows95  1  4  0  Windows98  1  4  10  WindowsMe   ...

  5. C#判断操作系统类型汇总

    Windows操作系统的版本号一览 操作系统 PlatformID 主版本号 副版本号 Windows95 1 4 0 Windows98 1 4 10 WindowsMe 1 4 90 Window ...

  6. C#判断操作系统类型

    操作系统  PlatformID  主版本号  副版本号  Windows95  1  4  0  Windows98  1  4  10  WindowsMe  1  4  90  WindowsN ...

  7. python判断字符串类型

    s为字符串 s.isalnum() 所有字符都是数字或者字母,为真返回 Ture,否则返回 False.(重点,这是字母数字一起判断的!!) s.isalpha() 所有字符都是字母,为真返回 Tur ...

  8. python判断操作系统

    https://www.crifan.com/python_get_current_system_os_type_and_version_info/ 参考:https://stackoverflow. ...

  9. python 判断操作系统以及操作系统版本号

    >>> import platform >>> platform.platform() 'Darwin-17.7.0-x86_64-i386-64bit' > ...

随机推荐

  1. hdu1542 Atlantis (线段树+扫描线+离散化)

    Atlantis Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total S ...

  2. Linux下双网卡绑定bond0【转】

    一:原理: linux操作系统下双网卡绑定有七种模式.现在一般的企业都会使用双网卡接入,这样既能添加网络带宽,同时又能做相应的冗余,可以说是好处多多.而一般企业都会使用linux操作系统下自带的网卡绑 ...

  3. 部署openfire到linux环境下

    1.java环境部署:具体参考 http://blog.csdn.net/gufachongyang02/article/details/45337379 2.ant环境部署: 具体参考 http:/ ...

  4. #define SIG_DFL ((void(*)(int))0)

    在linux内的信号处理函数中,有#define SIG_DFL ((void(*)(int))0)和#define SIG_IGN ((void(*)(int))1)两个宏定义.要理解这两个宏定义, ...

  5. GBDT 迭代决策树

    GBDT(Gradient Boosting Decision Tree) 又叫 MART(Multiple Additive Regression Tree),是一种迭代的决策树算法,该算法由多棵决 ...

  6. C语言禁术——goto语句

    goto语句是一种无条件转移语句,goto 语句的使用格式为:     goto  语句标号;其中标号是一个有效的标识符,这个标识符加上一个“:”(冒号)一起出现在函数内某处,执行goto语句后,程序 ...

  7. Mybatis缓存理解

    缓存 接触过hibernate的同学都知道hibernate中有个二级缓存,mybatis也存在二级缓存.mybatis中二级缓存有什么作用呢?mybatis提供查询缓存,可以提高查询效率,减轻数据库 ...

  8. C# Null 赋值

    在此之前,我们先看一段程序: class Program    {        static void Main(string[] args)        {            Childre ...

  9. C# 多态理解

    封装.继承.多态,面向对象的三大特性,前两项理解相对容易,但要理解多态,特别是深入的了解,对于初学者而言可能就会有一定困难了.我一直认为学习OO的最好方法就是结合实践,封装.继承在实际工作中的应用随处 ...

  10. WebApi增删改查Demo

    1.新建webapi项目 2.配置WebApiConfig public const string DEFAULT_ROUTE_NAME = "MyDefaultRoute"; p ...