I have a string as below ,
val = '["10249/54","10249/147","10249/187","10249/252","10249/336"]'
I need to parse it and take the values after / and put into list as below
['54','147','187','252','336']
My code: [a[a.index('/')+1:] for a in val[1:-1].split(',')]
Output : ['54"', '147"', '187"', '252"', '336"']
It has double quotes also " which is wrong. After i tried as below
c = []
for a in val[1:-1].split(','):
tmp = a[1:-1]
c.append(tmp[tmp.index('/')+1:])
Output :
['54', '147', '187', '252', '336']
Is there any better way to do this?