python list去重

python list去重

ids = [1,2,3,3,4,2,3,4,5,6,1]
news_ids = []
for id in ids:
    if id not in news_ids:
        news_ids.append(id)

print news_ids

也可以用set去重

posted on   奋斗的芒果ai榴莲  阅读(153)  评论(0编辑  收藏  举报
努力加载评论中...

点击右上角即可分享
微信分享提示