Contact: aviboots(AT)netvision.net.il
39,926 questions
51,859 answers
573 users
import re lst = ["c++", "python", "c#", "java", "c", "cc"] for s in lst: match = re.match("\Ac.+", s) if match: print(s) ''' run: c++ c# cc '''
lst = ["c++", "python", "c#", "java", "c", "cc"] ch = 'c' result = [i for i in lst if i[0].lower() == ch.lower()] print(str(result)) ''' run: ['c++', 'c#', 'c', 'cc'] '''