python lambda, filtering out non alpha characters -


i'm trying keep letters in string. trying this:

s = '1208uds9f8sdf978qh39h9i#h(&#*h(&h97dgh' s_ = lambda: letter if letter.isalpha(), s 

this errors out. how working version look?

how about

re.sub('[^a-za-z]','', s) 

or

"".join([x x in s if x.isalpha()]) 

Comments

Popular posts from this blog

Javascript line number mapping -

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -