從python中的列表中獲取唯一值我想從以下列表中獲取唯一值:[u'nowplaying', u'PBS', u'PBS', u'nowplaying', u'job', u'debate', u'thenandnow']我需要的輸出是:[u'nowplaying', u'PBS', u'job', u'debate', u'thenandnow']此代碼有效:output = []for x in trends:
if x not in output:
output.append(x)print output我應(yīng)該使用更好的解決方案嗎?
添加回答
舉報(bào)
0/150
提交
取消