gbk utf8 unicode

来源:互联网 发布:港融数据大平台主页 编辑:程序博客网 时间:2024/06/02 05:18
#!/usr/bin/env python# -*- coding: gbk -*-import chardeta='中国'print aprint type(a)print len(a)b=u'中国'print bprint type(b)print len(b)C:\Python27\python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/cookbook/a18.py�й�<type 'str'>4中国<type 'unicode'>2#!/usr/bin/env python# -*- coding: utf-8 -*-import chardeta='中国'print aprint type(a)print len(a)b=u'中国'print bprint type(b)print len(b)C:\Python27\python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/cookbook/a18.py中国<type 'str'>6中国<type 'unicode'>2