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
Post a Comment