How to access the low digits of a list

Frank Stutzman stutzman at cat2.kjsl.com
Tue Jun 2 08:34:14 EDT 2015


fl <rxjwg98 at gmail.com> wrote:

---snip----
>>>> lines
> ['12', '42', '49', '156', '225', '36', '49', '164', '11181', '3100']
> 
> 
> 
> I want to access the last two digits. That is:
> 
> ['12', '42', '49', '56', '25', '36', '49', '64', '81', '00']
> 
> 
> When I try to use lines[3][0] is '1'
> lines[3][1] is '5'
> lines[3][2] is '6'

Is there something wrong with using:
   lines[3][-2:]
   

-- 
Frank Stutzman




More information about the Python-list mailing list