python 判断操作系统类型
import sys
run_system = None
if sys.platform.startswith('linux'):
# print('当前系统为 Linux')
run_system = 'linux'
elif sys.platform.startswith('win'):
# print('当前系统为 Windows')
run_system = 'windows'
elif sys.platform.startswith('darwin'):
# print('当前系统为 macOS')
run_system = 'macOS'
else:
# print('无法识别当前系统')
run_system = "unknown"
if __name__ == '__main__':
print(run_system)