#!/usr/bin/env python
# -*- coding: gbk -*-
import chardet
a='中国'
print a
print type(a)
print len(a)
b=u'中国'
print b
print type(b)
print len(b)
C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/cookbook/a18.py
�й�
<type 'str'>
4
中国
<type 'unicode'>
2
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import chardet
a='中国'
print a
print type(a)
print len(a)
b=u'中国'
print b
print type(b)
print len(b)
C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/mycompany/cookbook/a18.py
中国
<type 'str'>
6
中国
<type 'unicode'>
2