zoukankan      html  css  js  c++  java
  • set 去重 会 破坏 原有list 的元素相对位置

    feature_reduce_l = [i if re.search('d', i) is None else i[0:re.search('d', i).endpos - 1] for i in feature_l]
    # set  破坏了顺序
    print(feature_reduce_l)
    print(list(set(feature_reduce_l)))
    
    feature_reduce_l = [e for i, e in enumerate(feature_reduce_l) if feature_reduce_l.index(e) == i]
    print(feature_reduce_l)
    
    
    
    
    
    ['uid', 'age', 'gender', 'marriageStatus', 'education', 'consumptionAbility', 'LBS', 'interest1', 'interest2', 'interest3', 'interest4', 'interest5', 'kw1', 'kw2', 'kw3', 'topic1', 'topic2', 'topic3', 'appIdInstall', 'appIdAction', 'ct', 'os', 'carrier', 'house']
    ['uid', 'age', 'gender', 'marriageStatus', 'education', 'consumptionAbility', 'LBS', 'interest', 'interest', 'interest', 'interest', 'interest', 'kw', 'kw', 'kw', 'topic', 'topic', 'topic', 'appIdInstall', 'appIdAction', 'ct', 'os', 'carrier', 'house']
    ['uid', 'topic', 'interest', 'education', 'ct', 'carrier', 'consumptionAbility', 'appIdAction', 'age', 'gender', 'appIdInstall', 'os', 'house', 'marriageStatus', 'kw', 'LBS']
    ['uid', 'age', 'gender', 'marriageStatus', 'education', 'consumptionAbility', 'LBS', 'interest', 'kw', 'topic', 'appIdInstall', 'appIdAction', 'ct', 'os', 'carrier', 'house']
    

      

  • 相关阅读:
    【Alpha阶段】第四次Scrum Meeting
    【Alpha阶段】第三次Scrum Meeting
    【Alpha阶段】第二次Scrum Meeting
    项目复审——Alpha阶段
    团队作业7-Alpha冲刺之事后诸葛亮
    团队作业6-展示博客
    Alpha阶段发布说明
    团队作业5-测试与发布
    冲刺博客-8
    冲刺博客-7
  • 原文地址:https://www.cnblogs.com/rsapaper/p/9062053.html
Copyright © 2011-2022 走看看