how to get INDEX count, or last number of Index
On Wednesday, May 23, 2018 at 5:56:26 PM UTC-4, Rob Gaddi wrote:
> On 05/23/2018 02:51 PM, asa32sd23 at gmail.com wrote:
> > s = "kitti"
> > 0,1,2,3,4
> > k,i,t,t,i
> > how do i retrieve '4'. i know i can do a len(s)-1, but i assume there is a function that gives me last number of index
> > thanks
> Not sure I'm following your question; len(s)-1 is much faster than
> enumerating over the string just to get the last index.
> If what you want is the current index, though, you can look at the
> enumerate function
> for i, c in enumerate(s):
> print(i, ':', c)
> Rob Gaddi, Highland Technology -- www.highlandtechnology.com
> Email address domain is currently out of order. See above to fix.
you understand my question. Im new to Python so thought maybe there is a function that returns the last value of the index. BUT if len(s) -1 is the answer. ill go with that.