Python Collections.defaultdict() Compile Error
The following code, simple and clear enough, produces an error when compiled: import string import collections #create dictionary with alphabets as keys, and empty values list = [
you overwrite the internal list
, being the name of a type, with your list = ['aema', 'airplane', 'amend']
above. Rename your list
to e.g. keys
or keylist
and all will be fine.
So replace
list = ['aema', 'airplane', 'amend']
with
keys = ['aema', 'airplane', 'amend']
and
forxin list:
with
forx in keys:
Post a Comment for "Python Collections.defaultdict() Compile Error"