How can I look up a value in a dict if I'm creating a variable with the Dicts name?
<p>Easier explained with code:</p>

<pre><code>#test data
Day1={  
      'data1':0,
      'data2':   1,
      'data3':    2,
      'data4':    3,
      'data5':    4,
      'data6':    5,
      'data7':    4,
      'data8':    3,
      'data9':    2,
      'data10':    1}

Day2= {  
       'data1':    2,
       'data2':    3,
       'data3':    4,
       'data4':    5,
       'data5':    6,
       'data6':    6,
       'data7':    7,
       'data8':    6,
       'data9':    4,
       'data10':    3}

Day3= {    
       'data1':    2,
       'data2':    4,
       'data3':    5,
       'data4':    6,
       'data5':    7,
       'data6':    6,
       'data7':    8,
       'data8':    6,
       'data9':    5,
       'data10':    4}

Day4= {   
       'data1':    2,
       'data2':    4,
       'data3':    5,
       'data4':    6,
       'data5':    7,
       'data6':    6,
       'data7':    6,
       'data8':    8,
       'data9':    5,
       'data10':    4}

AllData= {'Day1':Day1,'Day2':Day2,'Day3':Day3,'Day4':Day4}


#Number of items in AllData dictionary
AllDataSize = len(AllData)
CurrentDayCounter=0

while CurrentDayCounter &lt; AllDataSize:
    CurrentDayCounter=CurrentDayCounter+1
    CurrentDay = 'Day%s' % (CurrentDayCounter)
    #print AllData[CurrentDay]
    #add the nodes
    for day in AllData[CurrentDay]:
        print CurrentDay
        day = "%s" % (day)
        print CurrentDay[day] #does not work gives an error: TypeError: string indices must be integers, not str
        print CurrentDay[1] #works by providing a result 'a', which is the second letter in Day
        #print 'For ', CurrentDay, ' subgroup ', day,' contains ', CurrentDay[day], ' has been added to graph.'
        dayName =  "%s-%s" % (CurrentDay, Day1[day])
        #Do not create edges if its the first day
        if CurrentDay != "Day1":
            yesterday = CurrentDayCounter - 1
            print 'today is ', CurrentDayCounter, ' and yesterday is ', yesterday
</code></pre>

<p>When I do print <code>CurrentDay[day]</code> I get an error: <code>TypeError: string indices must be integers, not str</code> but CurrentDay[1] gives a result of a(which is the middle letter of the variable.  I want to use the variable to search the dictionary as opposed to pull up a letter position.</p>

<p>I suspect the way, I'm doing this is totally wrong, so is there a correct way to do this?</p>

<p>Thanks!
p.s. sorry for the bad code, I'm just playing around with networkx, I think I removed all references to it but if I missed anything just ignore it please.</p>
