more python3 regex?

Doug OLeary dkoleary at olearycomputers.com
Sun Sep 11 23:51:04 EDT 2016


Hey, all;

The print suggestion was the key clue.  Turned out my loop was slurping the whole of data in one big line.  Searching for a line that begins with Name when it's in the middle of the string is... obviously not going to work so well.

Took me a bit to get that working and, once I did, I realized I was on the wrong track altogether.  In perl, if possible, I will read a file entirely as manipulation of one large data structure is easier in some ways.  

Even with perl, though, that approach is the wrong one for this data.  While I learned lots, the key lesson is forcing data to match an algorithm works as well in python as it does in perl.  Go figure.

My 200+ script that didn't work so well is now 63 lines, including comments... and works perfectly.  

Outstanding!  Thanks for putting up with noob questions

Doug



More information about the Python-list mailing list