title: correlating text files to numbers
body: <p>Hello and thanks for looking :)</p>
  
  <p>I am relatively new to coding but have come to enjoy figuring out as much as I can for myself.  I've come to a situation where I dont know where to proceed.</p>
  
  <p>Basically I am trying to make an upgrade procedure for a device.  I have a text file with the names of versions of software to upgrade to on different lines of the text file already.  </p>
  
  <p>What I want to do is print a number, from 1 to wherever the file ends, and have that number be stored in a variable that will call the associated version number it was printed next to.  </p>
  
  <p>I have created something that RESEMBLES what I'm talking about, but there is no way (at least I dont think) to associate the count variable to the version printed after it.  </p>
  
  <pre><code>    def modify_ftp(self):
          with open('/tmp/ftp', 'r') as f:
              data = f.read().splitlines()
              count = 0
              for line in data:
                  if line.endswith('.bin'):
                      count = count + 1
                      print ("&gt; " + str(count) + " &lt;",  line)
              selection = raw_input("\tSelect a version of code to upgrade/downgrade to")
          os.remove('/tmp/ftp')
  </code></pre>
  
  <p>produces output similar to </p>
  
  <pre><code>('&gt; 1 &lt;', 'a.bin')
  ('&gt; 2 &lt;', 'b.bin')
  ('&gt; 3 &lt;', 'c.bin')
  ('&gt; 4 &lt;', 'd.bin')
  ('&gt; 5 &lt;', 'e.bin')
  ('&gt; 6 &lt;', 'f.bin')
  ('&gt; 7 &lt;', 'g.bin')
  ('&gt; 8 &lt;', 'h.bin')
  </code></pre>
  
  <p>To start out, I'll say that I'm sure there is a better way to do this in itself (even in its non functional method of programming).  I'd like to, on the next line, request input of a choice, and that choice would be tied to the relevant *.bin file for later processing in the program.  I am sorry if I was unclear in any way.  Thank you so very much in advance.</p>