Skip to content

Instantly share code, notes, and snippets.

Created October 15, 2017 17:02
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 anonymous/710fc5ee48a06ac8fd37c055764fc9d0 to your computer and use it in GitHub Desktop.
Save anonymous/710fc5ee48a06ac8fd37c055764fc9d0 to your computer and use it in GitHub Desktop.
def change_number(number):
number = number.replace(',','')
#handling it as an error
try:
int(number)
print(number)
except Exception:
print('None')
#using .isdigit()
if number.isdigit():
print(number)
else:
print('None')
change_number('123,123')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment