Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52610
| References | <1efhl8i0dmr9b.15q8opn6p0cj3.dlg@40tude.net> |
|---|---|
| Date | 2013-08-16 23:14 +0100 |
| Subject | Re: Proper use of the codecs module. |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.7.1376691263.23369.python-list@python.org> (permalink) |
On Fri, Aug 16, 2013 at 3:02 PM, Andrew <andrew@invalid.invalid> wrote: > I have a mixed binary/text file[0], and the text portions use a radically > nonstandard character set. I want to read them easily given information > about the character encoding and an offset for the beginning of a string. To add to all the information already given: Is the file small enough to comfortably fit into memory? If so, you'll find it a LOT easier to play with strings in RAM than files on disk. Even if not, you may find a lot of tasks simplified by just reading a kay or a meg in and then working within that. That spares you the fiddliness of read(1) all the time, at the expense of potentially reading more than you need. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Proper use of the codecs module. Andrew <andrew@invalid.invalid> - 2013-08-16 10:02 -0400
Re: Proper use of the codecs module. Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-16 19:12 +0000
Re: Proper use of the codecs module. Andrew <andrew@invalid.invalid> - 2013-08-16 16:16 -0400
Re: Proper use of the codecs module. Chris Angelico <rosuav@gmail.com> - 2013-08-16 23:14 +0100
csiph-web