Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created June 30, 2020 01:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/be84773d6acab00e85a42a1eeeae599b to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/be84773d6acab00e85a42a1eeeae599b to your computer and use it in GitHub Desktop.
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