Skip to content

Instantly share code, notes, and snippets.

@sleepless-se
Created February 3, 2022 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sleepless-se/18f4e26eb2398acf08396428043bf7ec to your computer and use it in GitHub Desktop.
Save sleepless-se/18f4e26eb2398acf08396428043bf7ec to your computer and use it in GitHub Desktop.
String number to int
@staticmethod
def to_int_number(text: str) -> int:
m = re.search(r'(\d+)', text)
if m is None: return 0
num = m.group()
return int(num)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment