shishirmk
shishirmk

Reputation: 425

pyparsing not working on windows text file but works on linux text file

I have a simple pyparsing construct for extracting parts of a log message. It looks like this

log_line = timestamp + task_info + Suppress(LineEnd())

This construct parses a log file generated in Linux very well but doesn't parse a similar file generated in windows. I am pretty sure it is because of the new line representation difference. I was wondering if LineEnd() takes care of that? If it doesn't how do I take care of it?

Upvotes: 1

Views: 174

Answers (1)

jsucsy
jsucsy

Reputation: 469

Try Suppress("\r\n") instead of Suppress(LineEnd())

Upvotes: 1

Related Questions