title: Extract the nth key in a python dictionary?
body: <p>Given a python dictionary and an integer <code>n</code>, I need to access the <code>n</code>th key. I need to do this repeatedly many times in my project.</p>
  
  <p>I have written a function which does this:</p>
  
  <pre><code>def ix(self,dict,n):
      count=0
      for i in sorted(dict.keys()):
          if n==count:
              return i
          else:
              count+=1
  </code></pre>
  
  <p>But the problem is that if the dictionary is huge, the time complexity increases when used repeatedly.</p>
  
  <p>Is there an efficient way to do this?</p>