Created
June 18, 2020 13:48
-
-
Save tpetazzoni/f9bebe40d51f90163ab0746db5dd665f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import distutils.version | |
>>> a = distutils.version.LooseVersion("2-3-15") | |
>>> hasattr(a, 'version') | |
True | |
>>> b = distutils.version.LooseVersion("2.3.1") | |
>>> hasattr(b, 'version') | |
True | |
>>> a < b | |
Traceback (most recent call last): | |
File "<stdin>", line 1, in <module> | |
File "/usr/lib64/python3.8/distutils/version.py", line 52, in __lt__ | |
c = self._cmp(other) | |
File "/usr/lib64/python3.8/distutils/version.py", line 337, in _cmp | |
if self.version < other.version: | |
TypeError: '<' not supported between instances of 'str' and 'int' | |
>>> print(a.version) | |
[2, '-', 3, '-', 15] | |
>>> print(b.version) | |
[2, 3, 1] | |
>>> a = distutils.version.LooseVersion("1-3-3") | |
>>> b = distutils.version.LooseVersion("3.4.5") | |
>>> a < b | |
True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment