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']
    

      

  • 相关阅读:
    animation关键帧动画语法
    border-image
    CSS3之box-shadow
    border-radius编程练习1-3
    CSS之border-radius
    CSS3之径向渐变
    CSS3之线性渐变(linear gradients)
    CSS之background——背景与渐变练习题
    background-image
    background-color
  • 原文地址:https://www.cnblogs.com/rsapaper/p/9062053.html
Copyright © 2011-2022 走看看