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)
精彩评论