python2中文字符处理,字符串处理

中文字符处理

str<---->unicode

从左到右是decode ,从右往左是encode

<type 'str'>  ---><type 'unicode'>

decode('utf-8','gbk','gb2312')

<type 'unicode'>  ---><type 'str'>

encode('utf-8','gbk','gb2312')

http://www.javashuo.com/article/p-hyjwwfsv-mu.html