# List Create by python

**URL:** <https://forum.dynamobim.com/t/list-create-by-python/20467>\
**Category:** Developers\
**Tags:** python, dynamo\
**Created:** [March 27, 2018, 2:50am UTC](https://forum.dynamobim.com/t/list-create-by-python/20467 "2018-03-27T02:50:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![robert12546358](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@robert12546358](https://forum.dynamobim.com/u/robert12546358)\
**Post date:** [March 27, 2018, 2:50am UTC](https://forum.dynamobim.com/t/list-create-by-python/20467/1 "2018-03-27T02:50:54Z")

</div>

hi,

i want list create using python.  
same like(see image)

 ![38](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/7/37cffb7b8d7efc0b2d425d1f038cf2dda5ca584f.JPG)

---

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [March 27, 2018, 3:14am UTC](https://forum.dynamobim.com/t/list-create-by-python/20467/2 "2018-03-27T03:14:03Z")

</div>

> **[Python's range() Function Explained | Python Central](https://www.pythoncentral.io/pythons-range-function-explained/)**
>
> A look at Python's range() function. It's usage, along with an explanation about xrange(). Their differences, and how to use range() with floats!

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.

---

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [March 27, 2018, 3:16am UTC](https://forum.dynamobim.com/t/list-create-by-python/20467/3 "2018-03-27T03:16:01Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![robert12546358](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@robert12546358](https://forum.dynamobim.com/u/robert12546358)\
**Post date:** [March 27, 2018, 3:17am UTC](https://forum.dynamobim.com/t/list-create-by-python/20467/4 "2018-03-27T03:17:03Z")

</div>

yes

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [March 27, 2018, 3:20am UTC](https://forum.dynamobim.com/t/list-create-by-python/20467/5 "2018-03-27T03:20:22Z")

</div>

Hi @robert12546358

Just few lines of code can also work here:  
 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/a/aa89f9409189497704474db95f3d919793621e0e.jpg)

---

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [March 27, 2018, 3:21am UTC](https://forum.dynamobim.com/t/list-create-by-python/20467/6 "2018-03-27T03:21:00Z")

</div>

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
```

---

<div class="post-metadata">

**Author:** ![kennyb6](https://avatars.discourse-cdn.com/v4/letter/k/7ba0ec/32.png) [@kennyb6](https://forum.dynamobim.com/u/kennyb6)\
**Post date:** [March 27, 2018, 3:21am UTC](https://forum.dynamobim.com/t/list-create-by-python/20467/7 "2018-03-27T03:21:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![robert12546358](https://avatars.discourse-cdn.com/v4/letter/r/c5a1d2/32.png) [@robert12546358](https://forum.dynamobim.com/u/robert12546358)\
**Post date:** [March 27, 2018, 3:23am UTC](https://forum.dynamobim.com/t/list-create-by-python/20467/8 "2018-03-27T03:23:35Z")

</div>

Thanks 😃😃👏👏👍👍

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [March 27, 2018, 3:26am UTC](https://forum.dynamobim.com/t/list-create-by-python/20467/9 "2018-03-27T03:26:24Z")

</div>

> [@kennyb6](#):
>
> 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.

No Problem @kennyb6 don’t be sorry. Cheers!

> [@robert12546358](#):
>
> Thanks 😃😃👏👏👍👍

@robert12546358 Please mark the post as solved. You’re welcome!
