天天看點

python 編碼轉換

# -*-coding:gbk-*-
python2.7 
utf8 轉gbk
string="";解碼  
string_unicode=string.decode("utf-8")
stirng_gbk=string_unicode.encode("gbk");
字元串常用函數
split 分割字元串 為清單
string="a|b|";
string.split("|"), 
join 連接配接字元串數組
print "+".join(['a','b'])連個參數
    a+b