diff Lib/string.py @ 102:f2cacb90c917 legacy-trunk

Fix bugf in index -- last char would not be checked.
author Guido van Rossum <guido@python.org>
date Wed, 26 Dec 1990 15:39:06 +0000
parents 5570dbb1ce55
children 48fc0b8f33d9
line wrap: on
line diff
--- a/Lib/string.py	Wed Dec 26 15:37:05 1990 +0000
+++ b/Lib/string.py	Wed Dec 26 15:39:06 1990 +0000
@@ -83,7 +83,7 @@
 index_error = 'substring not found in string.index'
 def index(s, sub):
 	n = len(sub)
-	for i in range(len(s) - n):
+	for i in range(len(s) + 1 - n):
 		if sub = s[i:i+n]: return i
 	raise index_error, (s, sub)