You could also try http://docs.python.org/library/stdtypes.html#str.join like this: for i in range(5): print "".join(str(i) for j in range(i))