<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                >[success] # 對list 元素去重 >[danger] ##### set -- 去重,但元素位置被打亂 ~~~ l = ["a", "c", "b", "e", "a"] print(set(l)) 打印結果: {'e', 'c', 'b', 'a'} ~~~ >[danger] ##### 只針對哈希去重,順序不變 * 哈希就是內部有一個__hash__方法,在聲明周期不可變的,例如數字,字符串,元組 ~~~ l = ["a", "c", "b", "e", "a"] def dedupe(items): seen =set() for i in items: if i not in seen: yield i seen.add(i) print(list(dedupe(l))) 打印結果: ['a', 'c', 'b', 'e'] ~~~ >[danger] ##### 針對哈希值的字典 * 字典中 v 是變化的可以重新不斷的賦值 ~~~ def dedupe(items,key=None): seen =set() for item in items: val = item if key is None else key(item) if val not in seen: yield item seen.add(val) print(list(dedupe(d,lambda d:(d["x"],)))) 打印結果: [{'y': 2, 'x': 1}, {'y': 4, 'x': 3}] ~~~ ![](https://box.kancloud.cn/a6be9d59c8144d84767d1854d09abbe5_800x256.png)
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看