<p>I have a list string tag.</p>

<p>I am trying to initialize a dictionary with the key as the tag string and values as the array index.</p>

<pre><code>for i, ithTag in enumerate(tag):
    tagDict.update(ithTag=i)
</code></pre>

<p>The above returns me {'ithTag': 608}  <em>608 is the 608th index</em></p>

<p>My problem is that while the i is being interpreted as a variable, Python is treating the "ithTag" as a string instead of a variable.</p>

<p>I'm confused, it is kind of hard to google these kind of specific questions.  I hope I worded the title of this question correctly,</p>

<p>Thanks!</p>

You actually want to do this:
```
```
for i, tag in enumerate(tag):
    tagDict[tag] = i
```
```
The .update() method is used for updating a dictionary using another dictionary, not for changing a single key/value pair.