Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with def, try, except
#2
You have an unnecessary parenthesis on this line:
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.
Reply


Messages In This Thread
Help with def, try, except - by dflick - Sep-23-2018, 05:00 PM
RE: Help with def, try, except - by Mekire - Sep-23-2018, 05:16 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020