Python_2_Examples_and_Notes/04_dict.py

29 lines
417 B
Python
Raw Permalink Normal View History

2017-06-11 19:42:13 +00:00
#!/usr/bin/python
# -*- coding: utf-8 -*-
myBio = {'name' : "unknown", 'age' : 666, 'hobby' : 'hacking'}
print myBio
myBio.has_key('hobby')
myBio.has_key('notinside')
myBio.values()
print myBio.get('age')
del myBio['age'] # Delete age
print myBio
dict_tuple = myBio.items() # into tuples
print dict_tuple
'name' in myBio
print myBio.has_key('hobby')
print dir(myBio)
help(myBio.update)
help(myBio.has_key)