代码:

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. ExcelConvert

    public static class ExcelConvert { #region - 由数字转换为Excel中的列字母 - public static int ToIndex(string col ...

  2. 菜鸟学Java(十七)——Jboss瘦身

    大家在用Jboss的时候可能跟我一样,觉得Jboss启动实在太慢!比起Tomcat几乎秒启的速度,Jboss几乎让人无法忍受.加上本人电脑配置比较低,Jboss启动最快的时候也是一分多钟,慢的时候四分 ...

  3. Android 自定义Dialog 去除阴影

    自定义Dialog中添加下列代码: window.clearFlags( WindowManager.LayoutParams.FLAG_DIM_BEHIND);

  4. 对于iOS开发人工智能意味着什么

    对于iOS开发人工智能意味着什么? 前言 近几年来人工智能的话题那是炙手可热.在国内很多大佬言必谈机器学习和大数据:在美国刚毕业的人工智能 PHD 也是众人追捧,工资直逼 NFL 四分卫.人工智能甚至 ...

  5. 【Web】Tomcat中利用Session识别用户的基本原理

    HTTP无状态的特性与Session.Cookie的存在 HTTP有一个特性:无状态的,就是前后两个HTTP事务它们并不知道对方的信息. 而为了维护会话信息或用户信息,一般可用Cookie或Sessi ...

  6. uWSGI listen queue 队列溢出的问题

    如果没有设置uwsgi的--listen,如果sysctl -a | grep net.core.somaxconn发现net.core.somaxconn=128. 那你使用uwsgi启动的服务,单 ...

  7. Delphi对象池MyObjectPool.pas

    对象池一般在服务端使用,所以稳定性是第一的. 欢迎提意见 unit uMyObjectPool; interface uses SyncObjs, Classes, Windows, SysUtils ...

  8. java中的动态加载和热替换

    https://blog.csdn.net/u010833547/article/details/54312052 ****************************************** ...

  9. LeetCode: Binary Tree Level Order Traversal 解题报告

    Binary Tree Level Order Traversal Given a binary tree, return the level order traversal of its nodes ...

  10. 【Linux】crontab 定时启动sh

    crontab -e 20点59分启动脚本 59 20 * * * sh /home/fzuir/xingye4crawl/endXingYe4Crawl.sh >/home/fzuir/xin ...