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' > ...
随机推荐
- matlab: Attempt to execute SCRIPT *** as a function 错误
编写matlab程序时,出现了“Attempt to execute SCRIPT mean as a function”,其实这是“Attempt to execute SCRIPT *** as ...
- 解决jar格式文件,双击不能直接运行问题
前提: 安装了JDK 步骤: 1.先右击jar文件,打开方式->选择默认程序->浏览,选中jre下bin文件中javaw.exe(比如我的javaw.exe在C:\Program Fil ...
- vim学习笔记(12):在vim中修改文件编码,解决vim 打开乱码
在linux 中查看文件编码可以通过以下几种方式: 一.查看文件编码 1.查看文件编码file命令 :file ip.txt ip.txt: UTF-8 Unicode text, with esca ...
- 【Android】LayoutInflater
LayoutInflater的作用 LayoutInflater的作用类似于findViewById(). 不同点是: LayoutInflater是用来找res/layout/下的xml布局文件,并 ...
- CR, LF, CR/LF 回车 换行
[时间:2016-07] [状态:Open] 本文主要介绍"回车"(Carriage Return)和"换行"(Line Feed)这两个概念的来历和区别. C ...
- 14款超时尚的HTML5时钟动画
时钟动画在网页应用中也非常广泛,在一些个人博客中,我们经常会看到一些相当个性化的HTML5时钟动画.今天我们向大家分享了14款形态各异的超时尚HTML5时钟动画,其中有圆盘时钟.3D时钟.个性化时钟等 ...
- js设置cookie(原生js)
cookie 与 session 是网页开发中常用的信息存储方式.Cookie是在客户端开辟的一块可存储用户信息的地方:Session是在服务器内存中开辟的一块存储用户信息的地方. JavaScrip ...
- 【JavaScript】脚本
javascript: void((function() { var as = document.getElementsByTagName('a'); for (var i = 0, j = as.l ...
- spring InitializingBean
先说总结:1:spring为bean提供了两种初始化bean的方式,实现InitializingBean接口,实现afterPropertiesSet方法,或者在配置文件中同过init-method指 ...
- hibernate特殊的映射
<property name="update_date" column="update_date" type="java.sql.Timesta ...