你好世界 100 helloworld
python3 去除字符串中的數字python
python3:git
from string import digits s = 'abc123def456ghi789zero0' remove_digits = str.maketrans('', '', digits) res = s.translate(remove_digits) # 'abcdefghizero'
或者:web
filter(lambda x: x.isalpha(), "a1a2a3s3d4f5fg6h")
還能夠:微信
for i in range(10): a.replace(str(i),'')
python2:svg
from string import digits s = 'abc123def456ghi789zero0' res = s.translate(None, digits) # 'abcdefghizero'