title: Python Ignore lines in file that start with
body: <p>I am new to python. Within my python script I open a file for reading, and want to process certain lines. I want to ignore lines that start with either '*' or '#'. Here is my code:</p>
  
  <pre><code>line = DLF_P.readline()
  
  while line:
  
  if not line.startswith('*') or not line.startswith('#'):
  
      time = line.split()[0]
      print time
      time = datetime.strptime(time, FMT)
  
      if start &lt; bdoyend:
          print time
  
  line = DLF_P.readline()
  </code></pre>
  
  <p>I get the error that the first line (which contains an asterisk) does not match the format 'HH:MM:SS". I thought my code would ignore these types of lines.</p>
  
  <blockquote>
    <p>ValueError: time data '**' does not match format '%H:%M:%S'</p>
  </blockquote>
  
  <p>Am I doing this wrong? </p>