Skip to content
Advertisement

how to perform string formatting inside a dictionary?

lets say i have a payload which i am using to hit my API

JavaScript

but i wanted to make its pg_no value as dynamic using for loop i.e.

JavaScript

getting this error

JavaScript

Advertisement

Answer

first in your dictionary you are using same key from_data which is gonna be only last one present there. second main problem is causing by { bracket format use this place variable if you want to parse single single { then you have to use {{ in string . so simple put value in dictionary then convert to string like this

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement