get environment ( windows or unix) using jython

前端 未结 1 1016
抹茶落季
抹茶落季 2021-01-21 04:24

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\"):         


        
相关标签:
1条回答
  • 2021-01-21 04:48

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

    >>> import java.lang.System
    >>> java.lang.System.getProperty('os.name')
    u'Mac OS X'
    
    0 讨论(0)
提交回复
热议问题