Hi, I am very new to python. I have a sublist to level 3. How can I take every first item from the sublist? I want to do it in python… thank you.
So, something like this? But in Python?
Look into python
for loops. Depending on your list structure, it just becomes a single loop or nested loops to get to the level you’re after.
@newshunhk try this:
# Load the Python Standard and DesignScript Libraries import sys import clr clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * # The inputs to this node will be stored as a list in the IN variables. lists= IN listOfList = [lists] # Place your code below this line list1 = [item for item in lists] list2 = [item for item in lists for lists in listOfList] # Assign your output to the OUT variable. OUT = list1, list2
I didnt realize I can use for loop in that simple way!
Thanks all for the replies above too!!