1. 程式人生 > >python print列印中文

python print列印中文

#! /usr/bin/env python
# -*- coding: utf-8 -*-

import sys

print sys.getdefaultencoding()

a="測試"
b=u"測試"

print a.decode('utf-8').encode('cp936')
print a.decode('utf-8').encode('gb2312')

print b.encode('utf-8')

print type(a),type(b)