title: Threshold on duration in a log file
body: <p>I want to parse a log file with a python script to highlight lines with time more than a particular duration, say 50 ms.</p>
  
  <p>So I have already use the code below to convert it to csv, but this way needs some data cleaning.
  Any suggestions for a better way is appreciated.</p>
  
  <pre><code>with open(r"5.160.146.140.log", encoding="ISO-8859-1") as f, open('logfile.csv', 'w') as f2: 
      writer = csv.writer(f2)
      writer.writerow(['index', 'from', 'icmp_seq', 'ttl', 'time']) # column header
  
      i = 0
      for line in f:
          writer.writerow([i] + line.rstrip().split(' '))
          i += 1
          if i == 10000:
              break
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Byyfz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Byyfz.png" alt="enter image description here"></a></p>