使用jython获取环境(Windows或UNIX) [英] get environment ( windows or unix) using jython
本文介绍了使用jython获取环境(Windows或UNIX)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何确定环境是Windows还是Unix.我想执行如下所示的类似代码.请建议
how to find out if the environment is windows or unix . I want to execute such similar code as shown below. Please suggest
import os
if (os.getenv("windows"):
os.system(cmd/c ...)
if (os.getenv("unix")
os.system(sh shellscript.sh)
感谢您的所有帮助.
推荐答案
使用System.getProperty获取os.name属性.
Use System.getProperty to get the os.name property.
>>> import java.lang.System
>>> java.lang.System.getProperty('os.name')
u'Mac OS X'
这篇关于使用jython获取环境(Windows或UNIX)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文