platform模塊可以獲取操作系統的相關信息。
>>> platform.system() #獲取系統名稱 'Linux' >>> platform.architecture() #獲取系統位數 ('64bit', 'ELF') >>> platform.platform() #獲取操作系統名稱及版本號 'Linux-2.6.32-696.6.3.el6.x86_64-x86_64-with-centos-6.8-Final' >>> platform.uname() #匯總信息 uname_result(system='Linux', node='zww', release='2.6.32-696.6.3.el6.x86_64', version='#1 SMP Wed Jul 12 14:17:22 UTC 2017', machine='x86_64', processor='x86_64')