Get a comparison between 2 version strings
You can use this tool to compare 2 versions in order to know if is greater, lesser or equal to the other.
pip install version-comparison
get_lesser()function return the lesser version of the provided, if none is lesser, the result is a
get_greater()function return the greater version of the provided, if none is greater, the result is a
compare()function return which one is greater, lesser or equal to the other.
from versions_comparison import Comparison versions = Comparison(version_1, version_2) versions.get_lesser() versions.get_greater() versions.compare()
dot numbers: You can use numbers like
chars: You can validate a version with chars.
b > aor
d < z
There are a coulpe of exceptions that could be used to catch possible errors throwed by the library.
FormatVersion: This exception is thrown when the version provided does not have a valid format.
StringFormat: This exception is thrown when the version provided is not a valid string type.
from versions_comparison.exceptions import FormatVersion, StringFormat
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.