I have two lists, and I want to find the items with the same/partial characters and put the results in a dictionary:
list_a= ['helloyou', 'waithere', 'byenow']
list_b =[ 'wait', 'hello', 'bye']
Result wanted:
dict_c= {'helloyou:hello', 'waithere:wait', 'byenow:bye'}
I've tried this but doesn't seem to work:
dict_c= {j:i for i,j in zip(list_a,list_b) if re.match(j,i)}
EDIT:
I may have some items that don't start the same, for example:
list_a= ['helloyou', 'waithere', 'byenow']
list_b =[ 'yeswait', 'plushello', 'nobye']
Result wanted:
dict_c= {'helloyou:plushello', 'waithere:yeswait', 'byenow:nobye'}
EDIT
what if I could instead have a situation like this where I could use a separator to split the items and use the start with
list_a = ['hid/jui/helloyou', 'hhh/hdhdh/waithere', 'jcdjcjd/bdcdbc/byenow']
list_b = ['abc/efg/waitai_lp', 'hil/mno/helloai_lj', 'pqr/byeai_ki']
Result wanted
dict_c = {'hid/jui/helloyou:hil/mno/helloai_lj','hhh/hdhdh/waithere:abc/efg/waitai_lp', 'jcdjcjd/bdcdbc/byenow:pqr/byeai_ki'}