Possible Duplicate:
how can i get around declaring an unused variable in a for loop
In Python, particularly with a for-loop, is there a way to not create a variable if you don't care about it, ie the i
in this example which isn't needed:
for i in range(10):
print('Hello')
No, but often you will find that _
is used instead:
for _ in range(10):
print('Hello')
You only have to be careful when you use gettext
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With