how to get INDEX count, or last number of Index
bartc
bc at freeuk.com
Wed May 23 18:06:18 EDT 2018
On 23/05/2018 22:51, 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
Not for that trivial task. But you can create your own:
def upb(x): return len(x)-1 # 'upb' means 'upper-bound'
print (upb("kitti")) # output: 4
More information about the Python-list
mailing list