I'm loading in a data file that uses special formatting which includes **
to separate the file into sections. For example: **HEADER
, **COMMENTS
, **CONSTANTS
, and **DATA
are all section titles within the file, and each section needs to be handled differently. So I'm trying to index the locations of each section title all of which start with double asterisks.
I currently have:
Titles = [m.start() for m in re.finditer('e', mytxt)]
Which indexes the location of every e in the file. However:
Titles = [m.start() for m in re.finditer('**', mytxt)]
gives me:
error: nothing to repeat
I also tried:
Titles = [m.start() for m in re.finditer(r'**', mytxt)]
thinking it would turn the search term into raw text and stop trying to handle *
as a special character but it didn't work.