Created
October 15, 2017 17:02
-
-
Save anonymous/710fc5ee48a06ac8fd37c055764fc9d0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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