代码如下:
复制代码 代码如下:
import platformdef 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-post2008server-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()