Skip to main content
added 111 characters in body
Source Link
physicist
  • 904
  • 1
  • 13
  • 25

This is not possible, however you can try alternatives like merging the two ranges to a single list.

for i in (range(1)+ range(2)):
  print(i)
 

This should work. range(1) and range(2) are expanded to lists and you can always concatenate them using overloaded '+' operator.

PS:wont work in python3, possibly because range is generated on the fly.

This is not possible, however you can try alternatives like merging the two ranges to a single list.

for i in (range(1)+ range(2)):
  print(i)
 

This should work.

This is not possible, however you can try alternatives like merging the two ranges to a single list.

for i in (range(1)+ range(2)):
  print(i)
 

This should work. range(1) and range(2) are expanded to lists and you can always concatenate them using overloaded '+' operator.

PS:wont work in python3, possibly because range is generated on the fly.

Source Link
physicist
  • 904
  • 1
  • 13
  • 25

This is not possible, however you can try alternatives like merging the two ranges to a single list.

for i in (range(1)+ range(2)):
  print(i)
 

This should work.