This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author skip.montanaro
Recipients Benjamin Schollnick, skip.montanaro, xtreak
Date 2019-07-31.04:46:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1564548381.86.0.540784775843.issue37709@roundup.psfhosted.org>
In-reply-to
Content
Looking at your sample file, it seems stranger than you first indicated. Your line terminator actually appears to be '\x07\r\n', not just '\x07'.  Opening your file in text mode will leave you with '\x07' as the last character of the last cell in each row. I've attached two files, bell.csv, which has just '\x07' as the line terminator, and lfmapper.py, which provides a class (suboptimally named LFMapper) which takes a file object opened in binary mode and optional line_terminator and encoding args, and performs the necessary slicing of the input bytes, decoding them and returning strings.

Unless Python grows a way for you to tell the open() function what string to use as the line terminator in text mode, I don't think your example is ever going to work without some sort of shim class.
History
Date User Action Args
2019-07-31 04:46:21skip.montanarosetrecipients: + skip.montanaro, xtreak, Benjamin Schollnick
2019-07-31 04:46:21skip.montanarosetmessageid: <1564548381.86.0.540784775843.issue37709@roundup.psfhosted.org>
2019-07-31 04:46:21skip.montanarolinkissue37709 messages
2019-07-31 04:46:21skip.montanarocreate