title: Python - Trying to print each line that has a string value that matches the index provided
body: <p>Now I'm still pretty new to python and programming in general, but I know I've gone a bit of a roundabout way this entire program. But here is what I have and what I want if anyone can help.</p>
  <p>Begins by reading a text file e.g.</p>
  <p>ADF101,Lecture,Monday,08:00,10:00,Jenolan,J10112,Joe Blo<br />
  ADF101,Tutorial,Thursday,10:00,11:00,Jenolan,J10115,Cat Blue<br />
  ALM204,Lecture,Monday,09:00,11:00,Tarana,T05201,Kim Toll</p>
  <p>Then I make empty lists and append them with each index...</p>
  <pre><code>subjects = []
  lecturer = []
  
  for line in x:
      f = line.split(',')
      if len(fields) == 8:
          subjects.append([0])
          lecturer.append(f[7])
  </code></pre>
  <p>Then I provide an input that runs a function based on the input.</p>
  <pre><code>while True:
      filter = input(&quot;Choose filter. Or [Q]uit: &quot;)
  
      if filter.upper() == 'S':
          S(subjects)
          break
      elif filter.upper() == 'L':
          L(lecturer)
          break
  </code></pre>
  <p>Now if they choose L it runs this...</p>
  <pre><code>def L(lecturer):
      print (&quot;&quot;&quot;
  Lecturers
  ---------
  &quot;&quot;&quot;)
      print (''.join(['[' + str(ind + 1) + '] ' + x  for ind, x in enumerate(lecturer)]))
      pick_lecturer = input(&quot;\npick a lecturer: &quot;)
  </code></pre>
  <p>Which outputs like:</p>
  <pre><code>[1] Joe Blo   
  [2] Cat Blue   
  [3] Kim Toll
  </code></pre>
  <p>Here's where I'm stuck. I want to make it so that if the last<br />
  input is '1' it will read the file for each line with Joe Blo<br />
  and print the entire line. Without any external modules or libraries<br />
  Any guidance is appreciated. Thanks.</p>