Python: What OS am I running on?

前端 未结 26 1631
野趣味
野趣味 2020-11-22 05:44

What do I need to look at to see whether I\'m on Windows or Unix, etc?

26条回答
  •  悲&欢浪女
    2020-11-22 06:20

    /usr/bin/python3.2

    def cls():
        from subprocess import call
        from platform import system
    
        os = system()
        if os == 'Linux':
            call('clear', shell = True)
        elif os == 'Windows':
            call('cls', shell = True)
    

提交回复
热议问题