I have an input list:
list_1 = ['29','560001','08067739333','560037002','29AAACC0462F1Z0','55XX1XXX19','07S23X09','98561XXX1X9']
I have tried:
output_list = [i for i in list_1 if 'X' in i or i.isnumeric()==True]
Giving out with extra element '07S23X09' which is wrong:
output_list = ['29','560001','08067739333','560037002','55XX1XXX19','07S23X09','98561XXX1X9']
Expected output is the list with numbers and the elements with numbers and specific character X, else other elements should be discarded:
output_list = ['29','560001','08067739333','560037002','55XX1XXX19','98561XXX1X9']