我想获得字符串形式的unicode。为此我的代码在这里:
@api.multi
def _select_service_product(self):
r = []
for order in self.order_line:
res = order.product_id.type_service
r.append(res)
self.services_infor = r
l = self.services_infor
print "test,,,", res, self.services_infor, l
services_infor = fields.Char(compute ='_ select_service_product')
现在终端显示:
test ,,, d [False,u'a',u'd'] [False,u'a',u'd']
从这里我想要值a,b
答案 0 :(得分:0)
x = u"['a', 'b']"
# either you c an explicitly convert the unicode chars
print str(x)
output : "['a', 'b']"
#use eval function to make the unicode list to original
print eval(x)
output: ['a','b']