基本上,停止使用str
从Unicode
转换为编码的文本/
字节。
相反,请正确使用.encode()
编码字符串:
p.agent_info = u' '.join((agent_contact, agent_telno)).encode('utf-8').strip()
Python-UnicodeEncodeError:“ascii”编解码器无法对位置20中的字符u“\xa0”进行编码:序号不在范围(128)内
基本上,停止使用str
从Unicode
转换为编码的文本/
字节。
相反,请正确使用.encode()
编码字符串:
p.agent_info = u' '.join((agent_contact, agent_telno)).encode('utf-8').strip()