Contact: aviboots(AT)netvision.net.il
39,885 questions
51,811 answers
573 users
tpl_lst = [('x', 17), ('python', 18), ('.', 97), ('php', 6), ('*', 10), ('*.A.*', 3)] result = [(f, s) for f, s in tpl_lst if any(c.isalpha() for c in f)] print(result) ''' run: [('x', 17), ('python', 18), ('php', 6), ('*.A.*', 3)] '''
import re tpl_lst = [('x', 17), ('python', 18), ('.', 97), ('php', 6), ('*', 10), ('*.A.*', 3)] result = [e for e in tpl_lst if re.search(r'\w', e[0])] print(result) ''' run: [('x', 17), ('python', 18), ('php', 6), ('*.A.*', 3)] '''