hi,
i want list create using python.
same like(see image)
If you don’t feel like learning in depth or reading, the command is:
thisList = range(1,10)
Full command:
range([start,]end[,step]),
where the bracket variables are optional. start is default 0, step is default 1. The numbers go up to but not including end, so it will not be in the list. For your case, you make end 10, since it will not include 10, but instead stop at 1 step before, 9.
In your example, you have the list created as a list of list, is that intentional? And are you trying to replicate it in Python?
yes
Just few lines of code can also work here:
Then for list of list, you just have to wrap it in another list. There are two ways:
theList = [range(1,10)] #Directly make it into a list
or
listOfList = []
listOfList.append(range(1,10)) #Append to an existing list
Ah I misunderstood what you were asking, sorry. I thought you wanted to create a list of ranges, not turn an existing list into a nested list, my fault.
Thanks
No Problem @kennyb6 don’t be sorry. Cheers!
@robert12546358 Please mark the post as solved. You’re welcome!