title: How do I create a list, then len() it, then make an entry for every 'section' in that list in Python?
body: <p>So, I'm working on a project, which requires me to find how many 'objects' are in a list, which I accomplished via <code>len()</code>, however, now I need to make it where there is a choice (in easygui's <code>choicebox()</code>) for every entry in that list, without raising an 'out of range' exception.</p>
  
  <p>Basically, if there are 3 entries in the list, then I need <code>choicebox(msg="",title="",choices=[e[1])</code> to become <code>choicebox(msg="",title="",choices=[e[1],e[2],e[3]])</code>, and if there are 5 choices, I need it to become <code>choicebox(msg="",title="",choices=[e[1],e[2],e[3],e[4],e[5]])</code>and so on.</p>
  
  <p>Notes: I need <code>e[0]</code> to be skipped, that being either <code>.DS_Store</code>, <code>desktop.ini</code>, or <code>thumbs.db</code>.<br>
  I'm listing directories just before that, so if you could tell me how to only make the directories end up on the list, or even how to limit the entries to 22, that'd be greatly appreciated as well!!</p>
  
  <p>Sorry for the noobish question! I couldn't think of how to search for something like this, or a suiting title even.....</p>
  
  <p>EDIT: Here's my script due to request. It is almost bugless, but very incomplete and broken;</p>
  
  <pre><code>#imports
  from easygui import *
  import os
  #variables
  storyname = None
  #get user action
  def selectaction():
      d = str(buttonbox(msg="What would you to do?",title="Please Select an Action.",choices=["View Program Info","Start Reading!","Exit"]))
      if d == "View Program Info":
          msgbox(msg="This program was made solely by Thecheater887. Program Version 1.0.0.               Many thanks to the following Story Authors;                                                Thecheater887 (Cheet)",title="About",ok_button="Oh.")
          selectaction()
      elif d == "Exit":
          exit
      else:
          enterage()
  #get reader age
  def enterage():
      c = os.getcwd()
  #   print c
      b = str(enterbox(msg="Please enter your age",title="Please enter your age",default="Age",strip=True))
  #   print str(b)
      if b == "None":
          exit()
      elif b == "Age":
          msgbox(msg="No. Enter your age. Not 'Age'...",title="Let's try that again...",ok_button="Fine...")
          enterage()
      elif b == "13":
  #       print "13"
          choosetk()
      elif b &gt;= "100":
          msgbox(msg="Please enter a valid age between 0 and 100.",title="Invalid Age!")
          enterage()
      elif b &gt;= "14":
  #       print "&gt;12"
          choosema()
      elif b &lt;= "12":
  #       print "&lt;12"
          choosek()
      else:
          fatalerror()
  #choose a kids' story
  def choosek():
      os.chdir("./Desktop/Stories/Kid")
      f = str(os.getlogin())
      g = "/Users/"
      h = "/Desktop/Stories/Kid"
      i = g+f+h
      e = os.listdir(i)
      names = [name for name in e if name not in ('.DS_Store', 'desktop.ini', 'thumbs.db')]
      limit = 22 # maximum entries in the choicebox --&gt; e[1] until e[22]
      for i in xrange(1, len(e)): # starting from 1 because you don't want e[0] in there
          if(i &gt; limit):
              break # so if you have 100 files, it will only list the first 22
          else:
              names.append(e[i])
          #names = e[1:23]
      choicebox(msg="Please select a story.",title="Please Select a Story",choices=names)
  #choose a mature story
  def choosema():
      os.chdir("./Desktop/Stories/Mature")
  #choose a teen's story
  def choosetk():
      os.chdir("./Desktop/Stories/Teen")
  def fatalerror():
      msgbox(msg="A fatal error has occured. The program must now exit.",title="Fatal Error!",ok_button="Terminate Program")
  #select a kids' story
  def noneavailable():
      msgbox(msg="No stories are available at this time. Please check back later!",title="No Stories Available",ok_button="Return to Menu")
      enterage()
  selectaction()
  </code></pre>