Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #25154
| Date | 2012-07-10 20:26 +0100 |
|---|---|
| From | MRAB <python@mrabarnett.plus.com> |
| Subject | Re: Opening multiple Files in Different Encoding |
| References | <40633830-78ae-4cc6-8795-de5a352e0fb1@m2g2000pbv.googlegroups.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2000.1341948384.4697.python-list@python.org> (permalink) |
On 10/07/2012 18:46, Subhabrata wrote: > Dear Group, > > I kept a good number of files in a folder. Now I want to read all of > them. They are in different formats and different encoding. Using > listdir/glob.glob I am able to find the list but how to open/read or > process them for different encodings? > > If any one can help me out.I am using Python3.2 on Windows. > You could try different encodings. If it raises a UnicodeDecodeError, then it's the wrong encoding, Otherwise just look at the decoding result and see whether it "looks" OK. I believe that one method is to look at the frequency distribution of characters compared with sample texts.
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Opening multiple Files in Different Encoding Subhabrata <subhabangalore@gmail.com> - 2012-07-10 10:46 -0700
Re: Opening multiple Files in Different Encoding MRAB <python@mrabarnett.plus.com> - 2012-07-10 20:26 +0100
Re: Opening multiple Files in Different Encoding Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-11 06:22 +0000
Re: Opening multiple Files in Different Encoding subhabangalore@gmail.com - 2012-07-11 11:15 -0700
Re: Opening multiple Files in Different Encoding Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-07-11 18:24 -0400
Re: Opening multiple Files in Different Encoding Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-07-11 23:22 +0000
csiph-web