t={"Items":[{"AssetId":1609391663,"Name":"Green Checkered Lamp shade","AbsoluteUrl":"https://www.roblox.com/catalog/1609391663/Green-Checkered-Lamp-shade","Price":20,"BestPrice":null,"Remaining":null,"HasSecondaryInfo":false,"NoPriceText":null,"IsFree":false,"Creator":null,"AssetRestrictionIcon":{"TooltipText":null,"CssTag":null,"LoadAssetRestrictionIconCss":true,"HasTooltip":false},"AssetStatusIcon":{"CssTag":"sale","DisplayText":"New","ShowTimerIcon":true},"Thumbnail":{"Final":true,"Url":"https://t0.rbxcdn.com/9fbc2414f0f615cd69ac5b8438861eaa","RetryUrl":"","IsApproved":true}},{"AssetId":1587175771,"Name":"Overseer Wings of Terror","AbsoluteUrl":"https://www.roblox.com/catalog/1587175771/Overseer-Wings-of-Terror","Price":20000,"BestPrice":null,"Remaining":275,"HasSecondaryInfo":true,"NoPriceText":null,"IsFree":false,"Creator":null,"AssetRestrictionIcon":{"TooltipText":"Serialized limited release, resellable.","CssTag":"limited-unique","LoadAssetRestrictionIconCss":true,"HasTooltip":false},"AssetStatusIcon":null,"Thumbnail":{"Final":true,"Url":"https://t7.rbxcdn.com/f6de30365dbad45c10685044d46bdffa","RetryUrl":"","IsApproved":true}},
for i in range(5):
itm = t["Items"][i]["AssetId"]
if not ListedItems.get(itm):
if t["Items"][i]["AssetStatusIcon"]:
ListedItems[t["Items"][i]["AssetId"]] = True
msg = "@everyone\n\n-----New Item!-----\n" + t["Items"][i]["AbsoluteUrl"]
在itm = t["Items"][i]["AssetId"]
是我得到错误的地方?
我不知道为什么,因为我对使用python还比较陌生
错误是
list index out of range
要避免
index out of range
错误,可以使用以下方法:注意:您现有的json结构无效,您需要首先用
json.loads()
加载它,然后在jsonlint验证您的json结构相关问题 更多 >
编程相关推荐