Skip to main content
added 227 characters in body
Source Link
Sari
  • 636
  • 8
  • 13

If you need the numeric values, here's the quickest way:

dog, cat, rabbit = range(3) 

In Python 3.x you can also add a starred placeholder at the end, which will soak up all the remaining values of the range in case you don't mind wasting memory and cannot count:

dog, cat, rabbit, horse, *_ = range(100) 

If you need the numeric values, here's the quickest way:

dog, cat, rabbit = range(3) 

If you need the numeric values, here's the quickest way:

dog, cat, rabbit = range(3) 

In Python 3.x you can also add a starred placeholder at the end, which will soak up all the remaining values of the range in case you don't mind wasting memory and cannot count:

dog, cat, rabbit, horse, *_ = range(100) 
Post Made Community Wiki by Michael Truog
15 commenters can't be wrong
Source Link
badp
  • 11.9k
  • 5
  • 65
  • 91

If you need the numeric values, here's the quickest way:

(dog, cat, rabbit) = range(0,3) 

If you need the numeric values, here's the quickest way:

(dog,cat,rabbit) = range(0,3) 

If you need the numeric values, here's the quickest way:

dog, cat, rabbit = range(3) 
Source Link
Mark Harrison
  • 306.1k
  • 132
  • 355
  • 498

If you need the numeric values, here's the quickest way:

(dog,cat,rabbit) = range(0,3)