add utils.parse.try_int() because .isdigit() isnt good enough
This commit is contained in:
parent
accd127ce5
commit
7db17c0962
1 changed files with 6 additions and 0 deletions
|
@ -73,3 +73,9 @@ def keyvalue(s: str, delimiter: str=" "
|
|||
else:
|
||||
items[key] = None
|
||||
return items
|
||||
|
||||
def try_int(s: str) -> typing.Optional[int]:
|
||||
try:
|
||||
return int(s)
|
||||
except ValueError:
|
||||
return None
|
||||
|
|
Loading…
Add table
Reference in a new issue