Code: Alles auswählen
def _cut(self, string, startstr, endstr):
'''Returns the string between "startstr" and "endstr"'''
if string.find(startstr) or string.find(endstr) == -1:
return -1
else:
return string[string.find(startstr)+len(startstr):string.find(endstr)]
>>> cut('python ist toll', 'python ', ' toll')
'ist'
Aber bei diesem String klappt es nicht mehr:
http://paste.pocoo.org/show/52993/
-1
Er gibt mir immer nichts oder -1 zurück wenn ich z.B das probiere:
Code: Alles auswählen
cut(test, 'Gold', 'stand')
Hat jemand eine Idee?