print command don't work (subscripted) word[2:4]

gcmartijn at gmail.com gcmartijn at gmail.com
Tue Oct 7 20:50:51 CEST 2008


Why is this not working ?

bla = 'hondenriem'
print bla[0:4]  # correct ! (= hond)
print bla[3:2]  # nothing ! (= en)
print bla[6:3]  # nothing ! (= riem)

Why don't bla[3:2] and bla[6:3] won't work ?

I use this version:
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit
(Intel)] on win32

http://docs.python.org/tutorial/introduction.html#strings
word = 'HelpA'
>>> word[4]
'A'
>>> word[0:2]
'He'
>>> word[2:4]
'lp'



More information about the Python-list mailing list