title: What is the most efficient way to get first and last line of a text file?
body: <p>I have a text file which contains a time stamp on each line. My goal is to find the time range. All the times are in order so the first line will be the earliest time and the last line will be the latest time. I only need the very first and very last line. What would be the most efficient way to get these lines in python?</p>
  
  <p>Note: These files are relatively large in length, about 1-2 million lines each and I have to do this for several hundred files. </p>