Nested dictionaries trouble

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Wed Apr 18 15:37:47 EDT 2007


In <1176923772.011976.116190 at p77g2000hsh.googlegroups.com>, IamIan wrote:

> years = ["199%s" % x for x in range(0,10)]
> years += ["200%s" % x for x in range(0,10)]
> 
> I haven't had any luck doing this in one line though. Is it possible?

In [48]: years = map(str, xrange(1999, 2011))

In [49]: years
Out[49]:
['1999',
 '2000',
 '2001',
 '2002',
 '2003',
 '2004',
 '2005',
 '2006',
 '2007',
 '2008',
 '2009',
 '2010']

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list