How to verify only the elements names in a dictionary object?
<p>I have a VERY big dictionary in python and when I type dict.items(dic_name) it shows up so many stuff (matrix, vectors, etc). I just would like to see the elements names. What should I do?</p>

<p>For example when I have a list I type names (<code>my.list</code>) and it just displays the list elements name.  Is there a command like that in Python?</p>

<p>Well, if you only keys, ask for keys, not items :</p>

<pre><code>my_dict.keys()
</code></pre>

<p>If you strictly need it to be a list you can do :</p>

<pre><code>my_list = list(my_dict.keys())
</code></pre>

<p>Now if you want to iterate through them:</p>

<p>in python 2:</p>

<pre><code>for k in my_dict.iterkeys():
    do_something_with(k)
</code></pre>

<p>in python 3:</p>

<pre><code>for k in my_dict.keys():
    do_something_with(k)
</code></pre>

python python-2.7 python-3.x