chinese GBK encode - KerwinKoo/KerwinKoo.github.io GitHub Wiki
# !/usr/bin/python
#coding=gbk
string='我的' 这个是python的内建函数,位于unicode类。
unicode(string [, encoding[, errors]]) -> object
这个函数的作用是将string按照encoding的格式编码成为unicode对象。
省略参数将用python默认的ASCII来解码
位于unicode类中。
decode(...)
| S.decode([encoding[,errors]]) -> string or unicode
|
| Decodes S using the codec registered for encoding.
decode和encode都可以用于常规字符串和unicode字符串
但是:
str.decode()和unicode.encode()是直接正规的使用。
unicode.decode()会先将unicode转化成str,然后再执行decode()。
这里面涉及隐式类型转化的问题