I’d like some help solving my problem… I am not a Python User but I’m doing my best to learn.
Here is the issue : I would like to obtain a List of lists from a initial list, that contains only the element that are repeated more than once, but only one time.
EXEMPLE IMAGE :
0 appears only one time, so I don’t want it in the final list
1 & 2 appears twice, so I want them in the sublist of the final list
3 appears twice so I want him in the sublist containing 3 and 4
4 appears 3 times
5 same as 3
So as I said, not a Python User
But here is the beginning of my reflexion
(only read the dynamo primer course so…)
import clr import sys sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib') import System from System import Array from System.Collections.Generic import * clr.AddReference('ProtoGeometry') from Autodesk.DesignScript.Geometry import * clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.Elements) clr.ImportExtensions(Revit.GeometryConversion) clr.AddReference("RevitServices") import RevitServices from RevitServices.Persistence import DocumentManager from RevitServices.Transactions import TransactionManager clr.AddReference("RevitAPI") clr.AddReference("RevitAPIUI") import Autodesk from Autodesk.Revit.DB import * from Autodesk.Revit.UI import * #List that contain multiple list of the number we want to assemble IN=List_Of_IndexToAssemble #List that contain multiple list with the numbers that appears more thant once, but only one time result= #GOAL : ADD THE NUMBER_a only one time in a list IF IT APPEARS MORE THAN ONCE with the NUMBER_b + AND + Also take count the NUMBER_c in the list with the other number i NUMBER_c is with NUMBER_b #Check in all list, it the number appears more than ONCE for counter in List_Of_IndexToAssemble if counter.List.Count > 1 result.append(counter) #If it appears more than once, put it in a _sublist_ with the others that appears with it #Create a List with all _sublist_ OUT = result
Thanks all for your prescious time