“'set' object is not subscriptable”意味着你试图通过索引(例如,使用my_set[0])来访问集合中的元素,但集合(set)是一种无序的、不包含重复元素的数据结构,它不支持通过索引来访问元素。 二、导致错误的常见情况 尝试通过索引访问集合元素: python my_set = {1, 2, 3} print(my_set[0]) # TypeError...
jobs = {"老师","程序员","打酱油的"}foriinrange(3):print("姓名:{0},年龄:{1},工作:{2}".format(names[i],ages[i],jobs[i]))#TypeError: 'set' object is not subscriptable#表示把不具有下标操作的集合对象用成了对象[i] 1 2 3 4 5 6 7 8 9 以下是正确案例: names1 = ("你大爷"...
Python“TypeError: 'set' object is not subscriptable in Python”发生在我们尝试访问特定索引处的集合对象时,例如my_set[0]。 要解决该错误,请使用方括号声明列表,因为集合对象是无序且不可订阅的。
class Htmloutputer(object): def __init__(self): self.datas=[] def collect_data(self,data):#收集数据 if data is None:#如果数据是空的就返回 return self.datas.append(data)#否则就往列表中添加data def output_json(self):#写出文件 fout=open('9udata.json','w') fout.write('{')#0--...
当我对该方法进行函数调用时 create({'1','2'}) 我得到一个 TypeError: 'set' object is not subscriptable 在线错误 'AWS': list(map(lambda id: f"arn:aws:iam::{id}:root", ids[i:i + 200])) 。来自...
Using a set in a context where a subscriptable object is expected How to solve Typeerror: ‘set’ object is not subscriptable Here are some ways to fix the“TypeError: ‘set’ object is not subscriptable”error in Python. 1. Use a loop to iterate over the elements of the set ...
TypeError: 'set' object is not subscriptable Why Does the Error Occur? The Python TypeError: 'set' object is not subscriptable occurs if you try to access an element of a set using indexing or slicing that imply an ordering of the set. However, sets are unordered collections of unique elem...
Rasa Core version: rasa_core==0.12.2 Python version: python 3.6.6 Operating system (windows, osx, ...): Linux-Ubuntu Issue: Getting error as TypeError: ‘SlotSet’ object is not subscriptable from custom action Please find the error log ER...
main_activities is of type set, but index access was used, resulting in TypeError. Use the sorted() method to convert it to a list type, and then access it through subscripts. fix 'set' object is not subscriptable. f8c7972 Contributor Author Forgo7ten commented Mar 16, 2024 @erev0...