Hello,
I have a question about python lists. I want to have a script that automatically creates new lists with values. For instance a list may contain 5 values, after that automatically a new list is created with the other values. If this list contains also 5 values a new list must be created, and so forth till all values are stored in lists.
Does somebody has a solution, thanks in advance
Roman
Christian Gartland
Are you trying to create a list of 5 random values or are you trying to take a large list of existing values and pop 5 values into a new list until it reaches the end? It's hard to offer a good solution without knowing what your data set is. Since it is very difficult to dynamically create new variables within Python (many people suggest using a dictionary as a possible method), you're probably better off taking your original list of values, partitioning it in Grasshopper, and converting the data tree into a list of lists within python. Giulio Piacento has a good method of doing this (including a way to convert the list of lists back into a GH data tree): https://gist.github.com/piac/ef91ac83cb5ee92a1294
Jul 18, 2017