Python判断操作系统类型
代码:
- 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判断操作系统类型的更多相关文章
- python 判断操作系统类型
#!/bin/python # import platform def TestPlatform(): print ("----------Operation System--------- ...
- Java 判断操作系统类型(适用于各种操作系统)
Java 判断操作系统类型(适用于各种操作系统) 最近一段时间写一个授权的程序,需要获取很多信息来保证程序不能随意复制使用,必须经过授权才可以. 为了限制用户使用的操作系统,必须有统一的方法来获取才可 ...
- python实例[判断操作系统类型]
参考文献:http://bbs.chinaunix.net/thread-1848086-1-1.html 经常地我们需要编写跨平台的脚本,但是由于不同的平台的差异性,我们不得不获得当前所工作的平台( ...
- 深入C#判断操作系统类型的总结详解(转载)
Windows操作系统的版本号一览 操作系统 PlatformID 主版本号 副版本号 Windows95 1 4 0 Windows98 1 4 10 WindowsMe ...
- C#判断操作系统类型汇总
Windows操作系统的版本号一览 操作系统 PlatformID 主版本号 副版本号 Windows95 1 4 0 Windows98 1 4 10 WindowsMe 1 4 90 Window ...
- C#判断操作系统类型
操作系统 PlatformID 主版本号 副版本号 Windows95 1 4 0 Windows98 1 4 10 WindowsMe 1 4 90 WindowsN ...
- python判断字符串类型
s为字符串 s.isalnum() 所有字符都是数字或者字母,为真返回 Ture,否则返回 False.(重点,这是字母数字一起判断的!!) s.isalpha() 所有字符都是字母,为真返回 Tur ...
- python判断操作系统
https://www.crifan.com/python_get_current_system_os_type_and_version_info/ 参考:https://stackoverflow. ...
- python 判断操作系统以及操作系统版本号
>>> import platform >>> platform.platform() 'Darwin-17.7.0-x86_64-i386-64bit' > ...
随机推荐
- 使用 nw-builder 构建跨平台桌面应用程序
NW.js 是一个使用 Web 技术创建本地应用的框架,如 HTML.JavaScript 和 CSS.简单地说,当你在使用普通的流程开发一个 Web 应用时,开发完成后,运行一个生成器,将所有东西编 ...
- python常用运维脚本实例
转载 file是一个类,使用file('file_name', 'r+')这种方式打开文件,返回一个file对象,以写模式打开文件不存在则会被创建.但是更推荐使用内置函数open()来打开一个文件 ...
- CAS无锁实现原理以及ABA问题
CAS(比较与交换,Compare and swap) 是一种有名的无锁算法.无锁编程,即不使用锁的情况下实现多线程之间的变量同步,也就是在没有线程被阻塞的情况下实现变量的同步,所以也叫非阻塞同步(N ...
- pandas数组(pandas Series)-(2)
pandas Series 比 numpy array 要强大很多,体现在很多方面 首先, pandas Series 有一些方法,比如: describe 方法可以给出 Series 的一些分析数据 ...
- ashx页面返回json字符串|jQuery 的ajax处理请求的纠结问题
纠结,整了半天的jquery的ajax请求数据. 遇到的问题: 1 ajax方法一直进入error方法里,进入到请求的.ashx页面.这个问题,我未找到是什么原因.反正我使用了一下的代码,就好了. $ ...
- [Windows Azure] Managing SQL Database using SQL Server Management Studio
Managing Windows Azure SQL Database using SQL Server Management Studio You can use Windows Azure SQL ...
- Android 编程下实现 Activity 的透明效果
实现方式一(使用系统透明样式) 通过配置 Activity 的样式来实现,在 AndroidManifest.xml 找到要实现透明效果的 Activity,在 Activity 的配置中添加如下的代 ...
- 光照渲染[Unity]
http://www.unitymanual.com/m/Manual/RenderingPaths.html http://wenku.baidu.com/view/54eca9e09b896802 ...
- 【驱动】DM9000网卡驱动分析
Preface 内核源码版本:linux-2.6.18 网卡驱动·linux内核网络分层结构:http://infohacker.blog.51cto.com/6751239/122114 ...
- poj1753(位运算压缩状态+bfs)
题意:有个4*4的棋盘,上面摆着黑棋和白旗,b代表黑棋,w代表白棋,现在有一种操作,如果你想要改变某一个棋子的颜色,那么它周围(前后左右)棋子的颜色都会被改变(白变成黑,黑变成白),问你将所有棋子变成 ...