python每日学习01

platform库,跨平台时可以判断当前系统

import platform
def testPlatfrom():
    platform_system = platform.system()
    print(platform_system)
    #跨平台可以用
    OS_MAC = (platform_system == 'Darwin')
    OS_WIN = (platform_system == 'Windows')
    OS_LINUX = (platform_system == 'Linux')

if __name__ == '__main__':
     testPlatfrom()

你可能感兴趣的:(python每日学习01)