Created
October 15, 2017 17:18
-
-
Save anonymous/17eaf5506b15f357c976e4607ba97d7f 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): | |
#broken down | |
new_number = '' | |
for character in number: | |
if character.isdigit(): | |
new_number += character | |
print(new_number) | |
#condensed | |
new_number = ''.join([str(character) for character in number if character.isdigit()]) | |
print(new_number) | |
change_number('123,abc,123') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment