Re: Regular expression and exception

2008-11-15 Thread bearophileHUGS
Mr.SpOOn: > try: >     m = re.match('[1-9]$', my_string) > except: >     print 'something...' > ... > try: >    m.group() > except: >    print 'error...' Generally don't write a nude except, use qualified exceptions, that is put there one of more exceptions that you want to catch (be careful with

Re: Regular expression and exception

2008-11-15 Thread Arnaud Delobelle
Mr.SpOOn <[EMAIL PROTECTED]> writes: > Hi, > I've never used exception before, but I think now it's time to start. > > I've seen that there is a list of the built-in exceptions in the > Python docs, but this explains the meaning of every exception. Does > exist an inverted list? I mean, how may I

Regular expression and exception

2008-11-15 Thread Mr . SpOOn
Hi, I've never used exception before, but I think now it's time to start. I've seen that there is a list of the built-in exceptions in the Python docs, but this explains the meaning of every exception. Does exist an inverted list? I mean, how may I know what kind of exception is going to raise my