Recently began to chew PyQt.
The utility value of this goods is big, it is worth some effort to tinker, toss.
Getting started is a lot of guide books, get started faster. The missing is the high-tech documentation.
There are many things on the web that are more than a QT gourd.
Want to see the pioneers of the lessons, the search for the community, did not find the forum, only to find a mailing list.
Hard to get back a bunch of zip documents, do not want to manually disassemble, write a script to unpack, but encountered trouble.
Mailing list of documents, there will be many natural language encoding, sometimes there will be decoding error: Unicodeencodeerror.
Decoding the problem, is a very persistent python. I'm using 3.4.1, and I haven't really solved it.
Toss a half-day, self-made a way. Speak directly in code:
From gzip import gzipfiledef Special (): z = Gzipfile ('./mails/2014-august.txt.gz ', ' R ') f = open ('./0001.txt ', ' W ') L = z.readlines () for B in L: try: s = B.decode (' GBK ') except: s = UTF8 (b) finally: s = str (b) try: f.write (s) except: continue F.close () #---------------------------- -----------------------def UTF8 (b): try: s = B.decode (' utf-8 ') return s except: return str (b)
"Little tricks" to kill Python decoding Unicodeencodeerror