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' > ...
随机推荐
- tengine 增加ngx_http_cache_purge_module 模块
wget http://labs.frickle.com/files/ngx_cache_purge-2.1.tar.gz tar zxvf ngx_cache_purge-2.1.tar.gz -- ...
- Warning Template OS Linux: /etc/passwd has been changed on {HOST.NAME} {monitor:vfs.file.cksum[/etc/passwd].diff(0)}>0 Unknown
# ll -h /etc/passwd -rw-r--r-- 1 root root 1.5K Apr 15 16:10 /etc/passwd 让zabbix 可以登录服务器 # mkdir /ho ...
- EditText: EditText自动获取焦点并弹出键盘&EditText不自动获取焦点并且不会弹出键盘
1.EditText不自动获取焦点并且不会弹出键盘 找到EditText的父控件,设置其父控件为: Parent.setFocusable(true); Parent.setFocusableInTo ...
- lua 工具类(一)
-- -- Author: My Name -- Date: 2013-12-16 18:52:11 -- csv解析 -- -- 去掉字符串左空白 local function trim_left( ...
- spark join
https://jaceklaskowski.gitbooks.io/mastering-apache-spark/content/spark-sql-joins.html https://acadg ...
- mysql 配置路径
1)关于配置文件路径 有时候,我发现虽然尝试修改了配置文件的一些变量,但是并没有生效.后来才发现原来是因为修改的文件并非MySQL服务器读取的配置文件. 如果不清楚MySQL当前使用的配置文件路径,可 ...
- JS中的history对象
window.history指向History对象,它表示当前窗口的浏览历史. History对象保存了当前窗口访问过的所有页面网址. history.back()//后退到前一个网址 等同于 his ...
- 三角形(css3)
.userCard .sanjiao {//三角形的制作: width: 0; height: 0; border-left: 10px solid transparent; border-right ...
- Mac在Finder中显示/usr、/tmp、/var等隐藏目录
Finder中默认是不显示/usr./tmp./var等隐藏目录的,通过在终端中输入一下命令来另其显示: #开启 defaults write com.apple.Finder AppleShowAl ...
- 在Jenkins上做一个定时闹钟
[本文出自天外归云的博客园] 利用Jenkins定时任务来做一个闹钟,每天隔一段时间提醒自己一下“你该休息了!别老坐着!出去走一走!珍爱生命,远离久坐!” 首先在Jenkins上创建一个node. 创 ...