如何在[<Car: { surname :yass name : zazadz } >]中转换u'[<Car: { surname :yass name : zazadz } >]。
那么如何在django.db.models.query.QuerySet中转换unicode呢?
发布于 2018-06-09 03:48:28
这是我编写的将unicode转换为字符串的函数,然后根据需要进行处理。_in_unicode是传递给此函数的参数,它接受unicode类型的输入。
def unicode_to_string(_in_unicode):
return unicodedata.normalize('NFKD', _in_unicode).encode('ascii', 'ignore')您必须编写一个解析器来处理该字符串,然后将其转换为适当的数据处理格式。
附言:如果你投了反对票,请添加评论,说明原因。
https://stackoverflow.com/questions/31965004
复制相似问题