1. 程式人生 > >python去掉字串中的字母,只保留數字

python去掉字串中的字母,只保留數字

>>> import os,sys,string
>>> s = "NaN9771Abc742055"
>>> s = filter(lambda ch: ch in '0123456789', s)
>>> print s
9771742055
>>>