Looking for a Simple Python script to create Table (solved without python)

python
dynamo

#1

I’m looking for a simple python script to create a table.
The goal is to repeat a list a given number of times.
Example:
if I were to have these inputs.
a b c
3
I want the output
a b c
a b c
a b c

Thanks in advance.

If you’re interested about the why:

I’m using the Element.SetParameterByName node and I’m trying to make it more elegant and versatile, currently, the parameterName input is a list, the value input a table, but to make it work the node “wants” to have a table for the element before it works.

Solved with the help of @MJB-online:


#2

See if you can find what you need in this thread


#3

Hi @PauLtus,

The “List.Cycle” node can create a list, by repeating a given value.

If you combine that with the “List.Count” node (on your other list), it gives you the right amount of values.

Kind regards,
Mark


#4

Thanks a lot!
I wish I knew that existed a bit earlier, I’ve actually gone through the entire list of nodes with the word list in it but hadn’t found it.


#5

After some minor alterations I managed to get what I wanted.

I did want the input list to be an actual list and not simply a string but after some splitting up I managed to get what I wanted: