distro ( pip), distro.linux_distribution. , platform.
https://github.com/nir0s/distro ( distro, on pypi)
It provides a much more sophisticated API for retrieving distribution related information.
$ python
Python 2.7.12 (default, Nov 7 2016, 11:55:55)
[GCC 6.2.1 20160830] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import distro
>>> distro.linux_distribution()
(u'Antergos Linux', '', u'ARCHCODE')
By the way, platform.linux_distributionit should be removed in Python 3.7.
nir0s source
share