开发者

get environment ( windows or unix) using jython

开发者 https://www.devze.com 2023-01-03 04:43 出处:网络
how to find out if the environment is windows or unix . I want to execute such similar code as s开发者_StackOverflow中文版hown below. Please suggest

how to find out if the environment is windows or unix . I want to execute such similar code as s开发者_StackOverflow中文版hown below. Please suggest

import os
if (os.getenv("windows"):
    os.system(cmd/c ...)

if (os.getenv("unix")
    os.system(sh shellscript.sh)

Thanks for all your help.


Use System.getProperty to get the os.name property.

>>> import java.lang.System
>>> java.lang.System.getProperty('os.name')
u'Mac OS X'
0

精彩评论

暂无评论...
验证码 换一张
取 消