IamIan a écrit : > 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?
# Q, D and pretty obvious years = ["199%s" % x for x in range(0,10)] + ["200%s" % x for x in range(0,10)] # hardly more involved, and quite more generic years = ["%s%s" % (c, y) for c in ("199", "201") for y in range(10)] -- http://mail.python.org/mailman/listinfo/python-list