title: Iterate over a list of images and assign them as variables in python
body: <p>I am trying to write a function that iterates over a list of images in python so that they are accessible for Pillow image processing.</p>
  
  <pre><code>ImTestA = Image.open("A.png")
  ImTestB = Image.open("B.png")
  ImTestC = Image.open("C.png")
  ImTest1 = Image.open("1.png")
  ImTest2 = Image.open("2.png")
  ImTest3 = Image.open("3.png")
  ImTest4 = Image.open("4.png")
  ImTest5 = Image.open("5.png")
  ImTest6 = Image.open("6.png")
  </code></pre>
  
  <p>I currently have the above but am trying to refactor it into something I can assign different length to (use a list with A-K or J-Z).</p>
  
  <pre><code>from PIL import Image
  
  AtoC = ["A.png", "B.png", "C.png"]
  
  def OpenAns(quest):
      AtoCImages = []
      for image in quest:
          AtoCImages.append(Image.open(image))
          return AtoCImages
  
  OpenAns(AtoC)
  
  ImTestA = AtoCImages[0]
  ImTestB = AtoCImages[1]
  ImTestC = AtoCImages[2]
  </code></pre>
  
  <p>Fixed earlier error, and went back to same problem as before. I am just trying to clean up my code and have it nice and DRY. Any help is appreciated.</p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\ImageTest.py", line 13, in &lt;module&gt;
      ImTestA = AtoCImages[0]
  NameError: name 'AtoCImages' is not defined
  </code></pre>
  
  <p>Maybe I will just have separate files with a list in each. If I cant shorten this up.</p>