You can just construct a list from the range object.
Example convert range to list in Python
Simple python example code.
Generate number 0 to 1 using range
my_list = list(range(0, 11)) print(my_list)
Use Python For Loop, to iterate over each element of the range
range_1 = range(2, 20, 3) list_1 = list() for x in range_1: list_1.append(x) print(list_1)
[2, 5, 8, 11, 14, 17]
Create a list with numbers between 2 values
In Python 3.x range is an iterator. So, you need to convert it to a list:
my_list = list(range(11, 17)) print(my_list)
Output: [11, 12, 13, 14, 15, 16]
Do comment if you have any doubts and suggestions on this Python list topic.
Note: IDE: PyCharm 2021.1.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.