'set' object has no attribute 'append'
时间: 2023-09-30 16:02:57 浏览: 139
Python3下错误AttributeError: ‘dict’ object has no attribute’iteritems‘的分析与解决
5星 · 资源好评率100%
"'set' object has no attribute 'append'" 是一个错误信息,它表示在一个set对象上调用了append()方法,而set对象是不支持append()方法的。解决这个问题的方法是使用add()方法来向set对象中添加元素,而不是使用append()方法。 另外,还可以将set对象初始化为一个空列表[]而不是一个set集合{},这样就可以使用append()方法来添加元素。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [AttributeError: ‘set‘ object has no attribute ‘append‘解决办法](https://blog.csdn.net/qq_49641239/article/details/114495893)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [Python3: AttributeError: 'set' object has no attribute 'append' ##将items={0} 改为 items=[] 问题解决...](https://blog.csdn.net/stcaaa/article/details/85158778)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文