bag_id = 'abcd'
result_str = "{'affiliate_details.affiliate_bag_id': '{bag_id}'}".format(bag_id)
I want the output result_str as "{'affiliate_details.affiliate_bag_id':'abcd' }"
It gives a key error - affiliate_details
I tried with unpacking them using **{'bag_id':'abcd'} in the format but it too gives the same result. I think its assuming the kwarg for affiliate_details but how do I deal with a nested one?
Also tried providing this but it gives same error
result_str = "{'affiliate_details.affiliate_bag_id': '{bag_id}'}".format(**{'affiliate_details':'affiliate_details', 'bag_id':'abcd'})