I coded the python function given below:
def processstring(string):
gtkname=""
if string[0]=="/":
i=1
while(string[i]!="/"):
if i==len(string):
break
gtkname=gtkname+string[i]
i=i+1
return gtkname
return string
when I execute the code it gives me the following error:
while(string[i]!="/"):
IndexError: string index out of range.
I don't know why is it giving this error.
i=1line; also, what problem are you trying to solve with this function?i+1==len(string), noti==len(string), because python indicies are zero-based