title: csv row and column fetch
body: <p>So working on a program in Python 3.3.2. New to it all, but I've been getting through it. I have an app that I made that will take 5 inputs. 3 of those inputs are comboboxs, two are entry widgets. I have then created a button event that will save those 5 inputs into a text file, and a csv file. Opening each file everything looks proper. For example saved info would look like this:</p>
  
  <pre><code>Brad M.,Mike K.,Danny,Iconnoshper,Strong Wolf Lodge
  </code></pre>
  
  <p>I then followed a csv demo and copied this...</p>
  
  <pre><code>import csv
  
  ifile  = open('myTestfile.csv', "r")
  reader = csv.reader(ifile)
  
  rownum = 0
  for row in reader:
  # Save header row.
      if rownum == 0:
          header = row
      else:
          colnum = 0
          for col in row:
              print('%-15s: %s' % (header[colnum], col))
              colnum += 1
  
      rownum += 1
  
  ifile.close()
  </code></pre>
  
  <p>and that ends up printing beautifully as:</p>
  
  <pre><code>rTech: Brad M.
  pTech: Mike K.
  cTech: Danny
  proNam: ohhh
  jobNam: Yeah
  rTech: Damien
  pTech: Aaron
  </code></pre>
  
  <p>so on and so on. What I'm trying to figure out is if I've named my headers via</p>
  
  <pre><code>if rownum == 0:
          header = row
  </code></pre>
  
  <p>is there a way to pull a specific row / col combo and print what is held there??</p>
  
  <p>I have figured out that I could after the program ran do</p>
  
  <pre><code>print(col)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>print(col[0:10]
  </code></pre>
  
  <p>and I am able to print the last col printed, or the letters from the last printed col. But I can't go any farther back than that last printed col.</p>
  
  <p>My ultimate goal is to be able to assign variables so I could in turn have a label in another program get it's information from the csv file.</p>
  
  <pre><code>rTech for job is???
  look in Jobs csv at row 1, column 1, and return value for rTech
  </code></pre>
  
  <p>do I need to create a dictionary that is loaded with the information then call the dictionary?? Thanks for any guidance</p>
  
  <hr>
  
  <p>Thanks for the direction. So been trying a few different things one of which Im really liking is the following...</p>
  
  <pre><code>import csv
  
  labels = ['rTech', 'pTech', 'cTech', 'productionName', 'jobName']
  fn = 'my file.csv'
  
  cameraTech = 'Danny'
  f = open(fn, 'r')
  
  reader = csv.DictReader(f, labels)
  
  jobInformation = [(item["productionName"],
                 item["jobName"],
                 item["pTech"],
                 item["rTech"]) for item in reader if \
                  item['cTech'] == cameraTech]
  
  f.close()
  
  print ("Camera Tech: %s\n" % (cameraTech))
  print ("\n".join(["Production Name: %s \nJob Name: %s \nPrep Tech: %s \nRental Agent:      %s\n" % (item) for item in jobInformation]))
  </code></pre>
  
  <p>That shows me that I could create a variable through cameraTech and as long as that matched what was loaded into the reader that holds the csv file and that if cTech column had a match for cameraTech then it would fill in the proper information. 95% there WOOOOOO..</p>
  
  <p>So now what I'm curious about is calling each item. The plan is in a window I have a listbox that is populated with items from a .txt file with "productionName" and "jobName". When I click on one of those items in the listbox a new window opens up and the matching information from the .csv file is then filled into the appropriate labels.</p>
  
  <p>Thoughts??? Thanks again :)</p>