1
votes

I have this tuple

({ 'id': '28:1', 'name': 'exAW' }, )

and I want output like this:

{ 'id': '28:1', 'name': 'exAW' }

I need to remove the parenthesis and additional comma.

I am unable to get the desired output using replace function. I tried

res = [(sub[0].replace(K, ''), sub[1]) for sub in test_list] 

but I get an error. Can someone help?

just take the dict out of the tuple: tuple[0] - not a robot
"but I get an error". make a minimal reproducible example and post the full traceback of the error. What is sub and test_list? - Mark Tolonen