开发者

django list of unicode string to pure string

I'm using Django and Python

unicode_countries = request.POST.getlist(u'countries')
Returns [u开发者_高级运维'ai', u'ag', u'aw', u'bs']

My goals it to convert unicode_countries to MySQL IN string, which should look like 'ai', 'ag', 'aw', 'bs' which I will use in a MySQL statement as "WHERE countries in ('ai', 'ag', 'aw', 'bs')"

Please help.


No conversion needed.

MyModel.objects.filter(countries__in=unicode_countries)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜