Here is my code:
def substringRemove(self, src_str, begin_index, end_index):
if (begin_index <= 0) or (begin_index > end_index) or (end_index >= len(src_str)):
sys.exit("String index error")
else:
return src_str[:begin_index]+src_str[end_index:]
I run this code in Python2.7 and get error info:
if (begin_index <= 0) or (begin_index > end_index) or (end_index <= len(src_str)):
^
SyntaxError: invalid syntax
I can not figure it out...
Aucun commentaire:
Enregistrer un commentaire