Sep-23-2018, 05:16 PM
You have an unnecessary parenthesis on this line:
Also, for what it is worth 0 is usually a successful return value not a failure. If you must return a fail value then I suggest -1.
return (".".join((ver).split(".",2)[:2])Should be:
return ".".join((ver).split(".",2)[:2])That said, why are you even catching the exception? An exception being raised seems like exactly what you want if someone calls the function with the wrong format.
Also, for what it is worth 0 is usually a successful return value not a failure. If you must return a fail value then I suggest -1.