Slicing Issues

BJ Swope bigblueswope at gmail.com
Sun May 21 17:32:13 EDT 2006


On 5/21/06, Heiko Wundram <me+python at modelnine.org> wrote:
>
> 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.
> --
> http://mail.python.org/mailman/listinfo/python-list
>

Heiko,

Thank you.  I was thinking like mysql for the indexs.  Thinking start at 85
and go for 3 characters instead of like python start at x and go up to and
including y.

The pages I had googled showed examples that were less than clear ;)

BJ

-- 
We are all slave to our own paradigm. -- Joshua Williams
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060521/f11a2d5f/attachment.html>


More information about the Python-list mailing list