Slicing Issues

Heiko Wundram me+python at modelnine.org
Sun May 21 17:01:35 EDT 2006


Am Sonntag 21 Mai 2006 22:52 schrieb BJ Swope:
>     district_combo=line[85:3]

This returns the slice from character 85 to character 3 in the string, read 
forwards. Basically, as Python slices are forgiving (because the borders are 
actually "illogical"), this amounts to nothing, but could also amount 
to: "your indexing boundaries are invalid."

Basically, what you want is:

district_combo = line[85:88]

where 88 = 85 + 3 (3 being the length). Read up on Python slices...

--- Heiko.



More information about the Python-list mailing list