>> A tuple of exceptions works, just like what we did above, and more, >> i.e., (IndexError, ValueError, TypeError, KeyError... >> > Thank you, thank you, thank you! I'm sure it's been staring me in the face, > but I never realized I could use a tuple of exception types - that's why I > said it was a pain in the butt, trapping the exception and doing > "isinstance" checks against it. How did I miss this?
wow, you were really going out of your way. i believe the docs have some examples but cannot confirm this. > Learn something new every day, no? even i do. oh, here's something else for the OP... i forgot to mention there is a useful string method called isdigit() that you can use on the string in question. it returns True if all the chars in the string are digits, meaning that it's likely safe to call int() on it. cheers, -- wesley - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - "Core Python Programming", Prentice Hall, (c)2007,2001 "Python Fundamentals", Prentice Hall, (c)2009 http://corepython.com wesley.j.chun :: wescpy-at-gmail.com python training and technical consulting cyberweb.consulting : silicon valley, ca http://cyberwebconsulting.com _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor