On Wed, 18 Apr 2007 12:16:12 -0700, IamIan wrote: > I am using the suggested approach to make a years list: > > 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?
years = ["199%s" % x for x in range(0,10)] + \ ["200%s" % x for x in range(0,10)] Sorry for the line continuation, my news reader insists on breaking the line. In your editor, just delete the "\" and line break to make it a single line. If you don't like that solution, here's a better one: years = [str(1990 + n) for n in range(20)] Or there's this: years = [str(n) for n in range(1990, 2010)] Or this one: years = map(str, range(1990, 2010)) -- Steven. -- http://mail.python.org/mailman/listinfo/python-list