[Tutor] Python Scraping problem help

Alan Gauld learn2program at gmail.com
Thu May 27 12:59:51 EDT 2021


On 27/05/2021 17:33, Dennis Lee Bieber wrote:
> difference will be that enumerate counts from 0


Unless you give it a different starting number:

===================

class enumerate(object)
 |  enumerate(iterable, start=0)
 | 
 |  Return an enumerate object.
 | 
 |    iterable
 |      an object supporting iteration
 | 
 |  The enumerate object yields pairs containing a count (from start, which
 |  defaults to zero) and a value yielded by the iterable argument.

==================

>>> for n,v in enumerate([0,1,2,3],start=5):
	print(n,v)

5 0
6 1
7 2
8 3

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list