I want to write some install scripts by python, it should know the OS to choose either apt command or yum command.
It seems sys.platform can tell 'win32' or the others, but how to know it is working on  Debian or CentOS in Python?
If you just need to know whether to use yum or apt, one approach is simply to pick one of those commands and try it.  If it works, it works; if not, catch the exception and try the other command.
How to know the system is Debian or CentOS in Python?