protect against numbers that do not have any numbers

This commit is contained in:
Frédéric Péters 2012-06-05 12:55:03 +02:00
parent 77dc6a2fc8
commit 42d241d89e
1 changed files with 2 additions and 2 deletions

View File

@ -8,8 +8,8 @@ def get_no_as_int(i):
if i:
if ' ' in i:
try:
return int(re.match('\d+', i).group())
except ValueError:
return int(re.match('\d+', i.strip()).group())
except (ValueError, AttributeError):
return 99999
try:
return int(i.split('-')[0])