Python Forloop Syntax
This works: for i in range(0, 3): print 'hi' This doesn't work: for range(0, 3): print 'hi' but I don't need the 'i' for anything at all. Is there a way to write a 'for'
Solution 1:
As mentioned elsewhere, this is an interesting and possibly faster alternative:
import itertools
for _ in itertools.repeat(None, 3):
print'hi'
Post a Comment for "Python Forloop Syntax"