take numbers wherever they are
This commit is contained in:
parent
42d241d89e
commit
45d30d4e13
|
@ -6,15 +6,15 @@ import tabellio.config.utils
|
|||
|
||||
def get_no_as_int(i):
|
||||
if i:
|
||||
if ' ' in i:
|
||||
try:
|
||||
return int(re.match('\d+', i.strip()).group())
|
||||
except (ValueError, AttributeError):
|
||||
return 99999
|
||||
try:
|
||||
return int(i.split('-')[0])
|
||||
except ValueError:
|
||||
return 99999
|
||||
pass
|
||||
try:
|
||||
return re.findall('\d+', i)[0]
|
||||
except IndexError:
|
||||
pass
|
||||
return 99999
|
||||
return 0
|
||||
|
||||
class Cmp:
|
||||
|
|
Reference in New Issue