Python 亂碼、編碼:unicode、uft-8、gbk

Python亂碼、編碼

三種編碼之間可以通過unicode進行轉化,內部默認存儲爲unicode格式

 

unicode爲中介

一般使用uft-8

gbk一般顯示爲亂碼

str.decode('utf-8').encode('gbk')

str.decode('gbk').encode('utf-8')

 

unicode可以顯示在hive表中

str.decode('utf-8')得到unicode格式的字符串

 

 

 

參考文獻:

https://blog.csdn.net/chixujohnny/article/details/51782826

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章