Sto usando Python 2.5, voglio un'enumerazione simile (a partire da 1 anziché 0):
[(1, 2000), (2, 2001), (3, 2002), (4, 2003), (5, 2004)]
So che in Python 2.6 puoi fare: h = enumerate (range (2000, 2005), 1) per dare il risultato sopra ma in python2.5 non puoi ...
Utilizzando python2.5:
>>> h = enumerate(range(2000, 2005))
>>> [x for x in h]
[(0, 2000), (1, 2001), (2, 2002), (3, 2003), (4, 2004)]
Qualcuno conosce un modo per ottenere il risultato desiderato in Python 2.5?
Grazie,
Jeff