-
-
Save IndhumathyChelliah/be84773d6acab00e85a42a1eeeae599b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d1={'name':'karthi','age':7} | |
print ("{name} is {age} years old".format(**d1))#Output:karthi is 7 years old | |
#using format_map | |
print ("{name} is {age} years old".format_map(d1))#Output:karthi is 7 years old | |
d2={'name':['karthi','Sarvesh'], | |
'age':[7,3]} | |
print ("{name[0]} is {age[0]} years old".format(**d2))#Output:karthi is 7 years old | |
print ("{name[0]} is {age[0]} years old".format_map(d2))#Output:karthi is 7 years old |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment