washakie wrote: > Could someone please explain 'slices' also for dictionaries? > > basically, I'd like to know how you would call every 3rd element in a list > of lists... > > My logic says: ThirdElems=List[:][2] > > Which to me reads, for every item in List (which are lists), return the > third item. > That is wishful reading. No basis in reality. List[:] gives you a shallow copy of List. [2] then refers to the 3rd element of that copy.
Try: [sublist[2] for sublist in List] -- Bob Gailer 919-636-4239 Chapel Hill, NC _______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
