1from sys import platform
2if platform == "linux" or platform == "linux2":
3 # linux
4elif platform == "darwin":
5 # OS X
6elif platform == "win32":
7 # Windows...
1>>> import platform
2>>> platform.platform()
3'Linux-3.3.0-8.fc16.x86_64-x86_64-with-fedora-16-Verne'
4
1from sys import platform
2if platform == "linux" or platform == "linux2":
3 # linux
4elif platform == "darwin":
5 # OS X
6elif platform == "win32":
7 # Windows...
8
1>>> import platform
2>>> platform.system()
3'Windows'
4>>> platform.release()
5'XP'
6>>> platform.version()
7'5.1.2600'
8