<tfoot id='Skfdi'></tfoot>
      <i id='Skfdi'><tr id='Skfdi'><dt id='Skfdi'><q id='Skfdi'><span id='Skfdi'><b id='Skfdi'><form id='Skfdi'><ins id='Skfdi'></ins><ul id='Skfdi'></ul><sub id='Skfdi'></sub></form><legend id='Skfdi'></legend><bdo id='Skfdi'><pre id='Skfdi'><center id='Skfdi'></center></pre></bdo></b><th id='Skfdi'></th></span></q></dt></tr></i><div id='Skfdi'><tfoot id='Skfdi'></tfoot><dl id='Skfdi'><fieldset id='Skfdi'></fieldset></dl></div>

      1. <small id='Skfdi'></small><noframes id='Skfdi'>

        <legend id='Skfdi'><style id='Skfdi'><dir id='Skfdi'><q id='Skfdi'></q></dir></style></legend>
        • <bdo id='Skfdi'></bdo><ul id='Skfdi'></ul>

        TypeError:'set' 对象不支持索引

        时间:2023-07-24
      2. <tfoot id='hT9Dq'></tfoot>

          <small id='hT9Dq'></small><noframes id='hT9Dq'>

          <legend id='hT9Dq'><style id='hT9Dq'><dir id='hT9Dq'><q id='hT9Dq'></q></dir></style></legend>
              • <bdo id='hT9Dq'></bdo><ul id='hT9Dq'></ul>
              • <i id='hT9Dq'><tr id='hT9Dq'><dt id='hT9Dq'><q id='hT9Dq'><span id='hT9Dq'><b id='hT9Dq'><form id='hT9Dq'><ins id='hT9Dq'></ins><ul id='hT9Dq'></ul><sub id='hT9Dq'></sub></form><legend id='hT9Dq'></legend><bdo id='hT9Dq'><pre id='hT9Dq'><center id='hT9Dq'></center></pre></bdo></b><th id='hT9Dq'></th></span></q></dt></tr></i><div id='hT9Dq'><tfoot id='hT9Dq'></tfoot><dl id='hT9Dq'><fieldset id='hT9Dq'></fieldset></dl></div>

                  <tbody id='hT9Dq'></tbody>

                  本文介绍了TypeError:'set' 对象不支持索引的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我刚刚在 Python 3.5 中做了一些随机的事情.用 15 分钟的空闲时间,我想出了这个:

                  I've just been doing some random stuff in Python 3.5. And with 15 minutes of spare time, I came up with this:

                  a = {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w",
                   "x", "y", "z"}
                  len_a = len(a)
                  list = list(range(0, len_a))
                  message = ""
                  wordlist = [ch for ch in message]
                  len_wl = len(wordlist)
                  for x in list:
                      print (a[x])
                  

                  但是那种随机成功的满足感并没有让我心烦意乱.相反,失败的感觉:

                  But that satisfying feel of random success did not run over me. Instead, the feeling of failure did:

                  Traceback (most recent call last):
                  File "/Users/spathen/PycharmProjects/soapy/soup.py", line 9, in  <module>
                  print (a[x])
                  TypeError: 'set' object does not support indexing
                  

                  请帮忙

                  推荐答案

                  试试方括号:

                  a = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w",
                   "x", "y", "z"]
                  

                  即:使用 list 而不是 set

                  这篇关于TypeError:'set' 对象不支持索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:pprint 排序字典但不是集合? 下一篇:将数字 1 添加到集合中没有效果

                  相关文章

                1. <legend id='m20jx'><style id='m20jx'><dir id='m20jx'><q id='m20jx'></q></dir></style></legend>
                  1. <i id='m20jx'><tr id='m20jx'><dt id='m20jx'><q id='m20jx'><span id='m20jx'><b id='m20jx'><form id='m20jx'><ins id='m20jx'></ins><ul id='m20jx'></ul><sub id='m20jx'></sub></form><legend id='m20jx'></legend><bdo id='m20jx'><pre id='m20jx'><center id='m20jx'></center></pre></bdo></b><th id='m20jx'></th></span></q></dt></tr></i><div id='m20jx'><tfoot id='m20jx'></tfoot><dl id='m20jx'><fieldset id='m20jx'></fieldset></dl></div>

                    1. <small id='m20jx'></small><noframes id='m20jx'>

                      <tfoot id='m20jx'></tfoot>

                      • <bdo id='m20jx'></bdo><ul id='m20jx'></ul>