insert multiple elements in string in python
- by Anurag Sharma
I have to build a string like this
{ name: "john", url: "www.dkd.com", email: "john@fkj.com" }
where john, www.dkd.com and john@fkj.com are to be supplied by variables
I tried to do the following
s1 = "{'name:' {0},'url:' {1},'emailid:' {2}}"
s1.format("john","www.dkd.com","john@fkj.com")
I am getting the following error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
KeyError: "'name"
Dont able to understand what I am doing wrong