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?
The platform module in the standard library has what you want.
import platform
print platform.linux_distribution()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With