700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > Python判断操作系统类型代码分享

Python判断操作系统类型代码分享

时间:2021-01-03 18:20:43

相关推荐

Python判断操作系统类型代码分享

后端开发|Python教程

Python,判断操作系统类型

后端开发-Python教程

经常地我们需要编写跨平台的脚本,但是由于不同的平台的差异性,我们不得不获得当前所工作的平台(操作系统类型)。

php论坛源码排行,ubuntu 串口是否正常,urllib3爬虫,建立 php,seo团队方法lzw

代码如下:

发卡系统源码.asp,ubuntu重建分区信息,服务器tomcat启停,爬虫图鉴解读,php访问后缀正确才能打开,php url seolzw

复制代码 代码如下:

家电售后php网站源码,ubuntu保存修改文件,小程序获取Tomcat图片,爬虫怎么保养,php先学什么好,seo找谁lzw

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.2600-SP3 or Windows-postServer-6.1.7600

#Linux will be : Linux-2.6.18-128.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.1 or 3.1.3

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()

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。