Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

How to assign a value to a dictionary if I need to reference it in the right hand side?

import collections
mydict = collections.defaultdict(str)

range_val = [str(i).zfill(2) for i in range(100)]

for v in range_val:
   mydict[v] = mydict[v] + 1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #assign #dictionary #I #reference #hand
ADD COMMENT
Topic
Name
5+1 =