标签:显示 pre keyword ber func cti python decode dex
replace(u‘\u3000‘,u‘‘)
string1
=
‘\xa1\xa1\xb0\xe9‘
#GBK下显示为“ 伴”
string2
=
‘\xb0\xa1\xa1\xe9‘
#GBK下显示为“啊¢”
print
string1.decode(
‘GBK‘
).replace(u
‘\u3000‘
, u‘‘)
#输出“伴”
print
string2.decode(
‘GBK‘
).replace(u
‘\u3000‘
, u‘‘)
#输出“啊¢”
string1
=
‘\xa1\xa1\xb0\xe9‘
#GBK下显示为“ 伴”</span>
string2
=
‘\xb0\xa1\xa1\xe9‘
#GBK下显示为“啊¢”
print
string1.replace(
‘ ‘
, ‘‘)
print
string2.replace(
‘ ‘
, ‘‘)
标签:显示 pre keyword ber func cti python decode dex
原文地址:http://www.cnblogs.com/realmonkeykingsun/p/7955967.html