The os
module provides an interface to determine what type of operating system the code is currently running on.
os.name
This can return one of the following in Python 3:
posix
nt
ce
java
More detailed information can be retrieved from sys.platform