python 下 判斷操做系統

import platform

OS = platform.system() # Windows, Linux, Darwin


def get_sys():
    if OS == 'Darwin':
        print('Darwin')
    elif OS  == 'Linux':
        print('Linux')
    elif OS =='Windows':
        print('Windows')
    else:
        print(OS)


get_sys()
相關文章
相關標籤/搜索