-2
我試圖做一個瞬移模塊一場比賽,但是首先我必須從ListBoxExPython的正則表達式:關於獲取文本
self.Gui[3].AppendItem(Item(str(chr.GetNameByVID(i)) + " " + str(nonplayer.GetLevelByVID(i)) + " " + "%d, %d" % (mobX/100, mobY/100)))
http://i.stack.imgur.com/MX8aV.jpg
得到座標我想這
mob_x, mob_y = re.findall(r"\(([0-9]+), ([0-9]+)\)", item_index.GetText())[0]
結果:索引錯誤
def Teleport(self):
item_index = self.Gui[3].GetSelectedItem()
if not item_index:
chat.AppendChat(chat.CHAT_TYPE_INFO, "Kein Item ausgewählt!")
return
mob_x, mob_y = re.findall(r"\(([0-9]+), ([0-9]+)\)", item_index.GetText())[0]
chr.SetPixelPosition(mob_x, mob_y)
請問您可以複製一個您想用正則表達式解析的文本樣本嗎? – mariosangiorgio
索引錯誤意味着你得到一個空列表,即它沒有匹配任何東西。 –
你可能已經編輯了你以前的問題。 – IcyFlame