Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python defaultdict to dict

>>> #You can simply call dict:
>>> a
defaultdict(<type 'list'>, {'1': ['b', 'a'], '3': ['b'], '2': ['a']})
>>> dict(a)
{'1': ['b', 'a'], '3': ['b'], '2': ['a']}

# but remember that a defaultdict is a dict
# (with some special behavior, check source):
>>> isinstance(a, dict)
True
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #defaultdict #dict
ADD COMMENT
Topic
Name
8+6 =