title: Python: Get the line and column number of string index?
body: <p>Say I have a text file I'm operating on. Something like this (hopefully this isn't too unreadable):</p>
  
  <pre><code>data_raw = open('my_data_file.dat').read()
  matches = re.findall(my_regex, data_raw, re.MULTILINE)
  for match in matches:
      try:
          parse(data_raw, from_=match.start(), to=match.end())
      except Exception:
          print("Error parsing data starting on line {}".format(what_do_i_put_here))
          raise
  </code></pre>
  
  <p>Notice in the exception handler there's a certain variable named <code>what_do_i_put_here</code>. My question is: how can I assign to that name so that my script will print the <strong>line number</strong> that contains the start of the 'bad region' I'm trying to work with? I don't mind re-reading the file, I just don't know what I'd do...</p>