Uname etc. may be inconvenient. So check for the existence of / dev / null. Also make sure it is a device just in case. In principle, it can be applied to scripting languages other than Python.
unixcheck.py
from stat import S_ISCHR
from os import stat
def unixcheck():
try:
return S_ISCHR(stat('/dev/null').st_mode)
except:
return False
Recommended Posts