I have a list as follows:
part_list = ['Particle-8-c', 'Particle-38-c', 'Particle-37-c', 'Particle-13-c', 'Particle-57-c', 'Particle-62-c', 'Particle-63-c', 'Particle-58-c']
I need to automate the assignment of variables to get an outcome as such:
IP1 = MI['Particle-38-c']
IP2 = MI['Particle-8-c']
IP3 = MI['Particle-37-c']
IP4 = MI['Particle-62-c']
IP5 = MI['Particle-63-c']
IP6 = MI['Particle-13-c']
IP7 = MI['Particle-58-c']
IP8 = MI['Particle-57-c']
The variable names should be 'IP' + index (e.g. IP1 for the first variable) and assigned to MI + a list of each item in the dictionary (e.g. MI['item1']). The number of items in the list may vary depending on usage.
I have unsuccessfully tried for index, item in enumerate(coh_list): and similar variations.