0

If I need to run a code block at 100 times, I'll write code like this:

for x in xrange(100):
    #code block

But usually I won't use temporary variable x again.

And I think use this kind of temporary variable will cause code ugly.

Is there anyway can help me omit this kind of temporary variable?

Thank you.

Jack
  • 3
  • 3
  • 2
    Not if you are using a `for` loop. The convention is to use name the variable `_` or `__`; the latter won't clash with the name `_` being used for the `gettext()` function. – Martijn Pieters Dec 18 '15 at 16:51
  • you can use `_` or prepend `dummy` to the variable you declare – Asav Patel May 19 '16 at 01:41

0 Answers0