title: How can I read a text file and only print specific lines where the value in one column is above a threshold?
body: <p>I have to read a comma-separated text file that looks like this:</p>
  <pre><code>ID, x, y, soil_temp
  1, 10, 6, 8
  2, 21, 11, 12
  3, 11, 7, 7
  4, 32, 12, 8
  5, 9, 29, 6
  6, 17, 16, 9
  7, 22, 9, 11
  8, 14, 31, 7
  9, 26, 21, 6
  10, 19, 19, 10
  </code></pre>
  <p>And thereafter I have to print the columns ID and soil_temp and all the lines with soil temperature above 10. So the result should look something like this:</p>
  <pre><code>ID, soil_temp
  2, 12
  7, 11
  </code></pre>
  <p>Important! No modules should be needed such as pandas and cv, which makes the exercise frustrating for me. It is probably quite easy for most people here.</p>
  <p>So I have made a code that looks like this to be able to print the column with <code>soil_temp</code>:</p>
  <pre><code>tempLine = []
  with open('soil_temp.txt', 'r') as f:
      read_data = f.readlines()
  
  for line in read_data:
      line.split()
      tempLine.append(line.split())
  
  for item in tempLine:
      print(item[3])
  </code></pre>
  <p>This code is also based on advices given in the exercise. My problem is that if I want to only print the lines above 10, I would think a simple <code>if</code> statement in the last part of the code, something like this would make sense:</p>
  <pre><code>for item in tempLine:
      if item[3] &gt; 10
          print(item[3])
  </code></pre>
  <p>But of course this does not work since the data is stored as strings. I have tried different solutions to change them into integers but since it is multiple strings, I can't find a solution.</p>