title: how can i extract elements from lists in python
body: <p>I am trying to extract elements from list.
  I've looked up a lot of data, but I do not know..</p>
  
  <p>this is my test.txt (text file)<br>
   [    left in the table = time,  right in the table = value   ]</p>
  
  <pre><code>0  81       
  1  78       
  2  76
  3  74
  4  81
  5  79
  6  80
  7  81
  8  83
  9  83
  10  83
  11  82
    .
    .
  22  81
  23  80
  </code></pre>
  
  <p>If the current time is equal to the time in the table, i want to extract the value of that time.</p>
  
  <p>this is my demo.py (python file)</p>
  
  <pre><code>import datetime
  
  now = datetime.datetime.now())
  current_hour = now.hour
  
  with open('test.txt') as f:
      lines = f.readlines()
  
  time = [int(line.split()[0]) for line in lines]
  value = [int(line.split()[1]) for line in lines]
  
  &gt;&gt;&gt;time = [0,1,2,3,4,5,....,23]
  &gt;&gt;&gt;value = [81,78,76,......,80]
  </code></pre>