Created
March 22, 2014 19:14
-
-
Save ayota/9712667 to your computer and use it in GitHub Desktop.
python dict contacts
This file contains hidden or 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
contacts = {'Shannon': {'phone': '202-555-1234', 'twitter': '@svt827', 'github': '@shannonturner' }, | |
'Anupama': {'phone': '410-333-9876','twitter': '@iamtheanupama', 'github':''}} | |
# for contact in sorted(contacts.keys()): | |
# print "{0} : {1}".format(contact,contacts[contact]['phone']) | |
# | |
# for contact,info in sorted(contacts.items()): | |
# print "{0} : {1}".format(contact,info) | |
for contact,info in contacts.items(): | |
print "Name: {0} \n Phone: {1} \n Twitter: {2} \n Github: {3}".format(contact,info['phone'],info['twitter'],info['github']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment