Bug in string.find

Paul Rubin http
Thu Sep 1 23:02:58 EDT 2005


Ron Adam <rrr at ronadam.com> writes:
> All of the following get the center 'd' from the string.
> 
> a = 'abcdefg'
> print a[3]         # d   4 gaps from beginning
> print a[-4]        # d   5 gaps from end
> print a[3:4]       # d
> print a[-4:-3]     # d
> print a[-4:4]      # d
> print a[3:-3]      # d
> print a[3:2:-1]    # d   These are symetric?!
> print a[-4:-5:-1]  # d
> print a[3:-5:-1]   # d
> print a[-4:2:-1]   # d

+1 QOTW



More information about the Python-list mailing list