-3
나는 다음과 같은 연료 소모량을 호출하고있어
,파이썬에서 index()를 사용하려면 무엇을 가져올 필요가 있습니까?
import clr
import System
import ServiceDesk
import BaseModel
class Model(BaseModel.Model):
def ExecuteCustomAction(self,args,env):
resault = self.account.ExecuteService('service',args,env)
res = {}
if resault.Count>0:
for customaction in resault.Rows:
CustomActions = customaction['CustomActions']
if CustomActions !="":
Lable = self.find_between(CustomActions, "Lable", "d")
CallBack = self.find_between(CustomActions, "CallBack", ";")
Action = self.find_between(CustomActions, "Action", "f")
res['Lable'] = Lable
res['CallBack'] = CallBack
res['Action'] = Action
return res
def find_between(text, first, last ,self):
try:
start = text.index(first) + len(first)
end = text.index(last, start)
return text[start:end]
except ValueError:
return ""
을하지만이를 실행할 때, 그것은 내가 가져올 필요합니까
객체가 더 속성 '인덱스'
을 가지고 말을?
을 당신이 함수를 호출하는 방법? 해당 코드도 추가하십시오. – JRodDynamite
아무 것도 아니지만 '텍스트'가 무엇이든간에 '인덱스'메소드가 없습니다. 그것은 아마도 당신이 생각하는 것이 아닙니다. – RemcoGerlich
'가져 오기'할 필요가 없습니다. 당신은'index' 메소드를 가진 객체를 전달할 필요가 있습니다. – deceze