I tried searching around , perhaps I am not getting exact way to search the web or stack overflow for this requirement. Kindly re-direct me or provide a solution for one's below.
I have a list say (My original list has over 10k cities) :
A = ['BANGALORE', 'DUBAI', 'SHANGHAI' , 'SOUTH ASIA' , 'NORTH ASIA']
Now my requirement is match this list similar to LIKE
operator in ORACLE. I mean , if we enter BAN , it has to match BANGALORE. I accomplish this by following :
if 'BAN'in str(A) :
Do my stuffs
Now , if I need to retrieve that element from list where 'BAN' matched . How can we do it ?
In simple terms .
if 'BAN'in str(A) :
Display to me what is that A that matched 'BAN'.
I did some searching around but couldn't find a a solution