How could I parse the dictionary below, so that it's values only contain ticket numbers?
Current Dictionary:
{'8.8.8.8': 'Open Menu 10A-003272 10A-003328 10A-003652', '8.8.8.9': '10A-003069 10/21/2016', '8.8.8.10': 'Open Menu 10A-003145 10/21/2016'}
Objective Dictionary:
{'8.8.8.8': '10A-003272 10A-003328 10A-003652', '8.8.8.9': '10A-003069', '8.8.8.10': '10A-003145'}
Code used to make dictionary:
with open(esccbList, 'r') as f:
d = {}
for line in f:
d[line.strip()] = next(f, '').strip()
Regex to find ticket numbers:
n = re.search(r'10A-\d{6}',item, re.M|re.I)