regex line by line over file
bjlockie at lockie.ca
Thu Mar 27 14:41:55 CET 2014
On Thursday, March 27, 2014 1:32:03 AM UTC-4, Steven D'Aprano wrote:
> - are you mistaken about the content of the file?
> I can't help you with the first. But the second: try running this:
> # line2 and pat as defined above
> filename = sys.argv
> with open(filename) as f:
> for line in f:
> print(len(line), line==line2, repr(line))
> which will show you what you have and whether or not it matches
> what you think it has. I expect that the file contents is not what
> you think it is, because the regex is matching the sample line.
> Good luck!
It should match this:
(134, False, '\' "SHELF-17:LOG_COLN_IP,SC,03-25,01-18-58,NEND,NA,,,:\\\\"Log Collection In Progress\\\\",NONE:1700000035-6364-1048,:YEAR=2014,MODE=NONE"\\r\\n\'')
Is the \r\n on the end of the line screwing it up?
More information about the Python-list