我在python中遇到了这个错误,我不知道索引在下面指定的第756行中的位置:
Traceback (most recent call last):
File "EMMMOIScenario.py", line 22, in <module>
TheEMMSim.DVThrusterDynObject.ThrusterData[i].MaxThrust=0 #sets the ith thruster (in the square bracket) to zero
File "/Users/emanalawadhi/Desktop/MBRSCWork/TASKSWork/SSDD/EMX/ADCS/Simulator/EMMArchive/EMMData/EMMModules/../../Basilisk/modules/thruster_dynamics.py", line 756, in __getitem__
return _thruster_dynamics.ThrusterConfigVector___getitem__(self, *args)
IndexError: index out of range
IndexError意味着您可能试图访问不存在的列表中的项。 它看起来像是一个列表,而i是你想要的元素的索引。如果stresserData中有3个项(例如:}将导致索引错误,因为列表是0索引的,并且没有stresserdata[3]
ThrusterData = ['string 1', 'string 2', string 3']
)并运行ThrusterData[0]
,那么您将得到'string 1'
,但是{相关问题 更多 >
编程相关推荐