我的列表company_list_present
包含重复值,看起来像[u'SOUTH ASIAN ENTERPRISES LTD', u'SPICEJET LTD', u'SPICEJET LTD']
我已将此列表分配给词典
record['company_present'] = set(company_list_present)
当我把它作为json返回时,我发现它会像这样返回 -
'result': {'suspected': 95.941691412119113, 'unsuspected': 4.0583085878808909}, u'company_present': set(['DR REDDYS LABORATORIES LTD', 'ASTRA MICROWAVE PRODUCTS LTD'])
see u'company_present' value
如何将不同的列表分配给company_list_present?
答案 0 :(得分:3)
您只想将您设置为列表?然后
record['company_present'] = list(set(company_list_present))