python range(1)
时间: 2023-08-27 07:06:59 浏览: 82
Python库 | rangeset-0.0.10.tar.gz
The output of `range(1)` in Python is a range object containing a single element: `range(0, 1)`. This means that the range starts at 0 and goes up to, but does not include, 1. Therefore, the only element in this range is 0.
To convert the range object to a list, you can use the list() function like this:
```
my_range = range(1)
my_list = list(my_range)
print(my_list) # Output: [0]
```
阅读全文