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

mod rewrite - Doing external redirect. .htaccess NS flag not working. How to achieve similar results? -

mysql - How to insert just year and month into date field? -