how to remove digits in string in python 3f

Solutions on MaxInterview for how to remove digits in string in python 3f by the best coders in the world

showing results for - "how to remove digits in string in python 3f"
María Camila
18 Mar 2019
1>>> s = '12abcd405'
2>>> result = ''.join([i for i in s if not i.isdigit()])
3>>> result
4'abcd'
5
Sabri
24 Jul 2016
1no_digits = []
2# Iterate through the string, adding non-numbers to the no_digits list
3for i in s:
4    if not i.isdigit():
5        no_digits.append(i)
6
7# Now join all elements of the list with '', 
8# which puts all of the characters together.
9result = ''.join(no_digits)
10