1 #!/usr/bin/env python 2 #coding:utf-8 3 4 msg="我爱北京天安门" 5 6 print(msg.encode(‘utf-8‘)) 7 8 print((msg.encode(‘utf-8‘)).decode(‘utf-8‘))
python学习:编码转换
原文:http://www.cnblogs.com/alstonlee/p/6393227.html