Del function in ironpython dynamo

I’m trying to delete/ remove an item from a list using python scipt in dynamo. But when I use del function of python, I have an error : "Unexpected token 'del ’ " And then I try to use List.RemoveItemAtIndex but it doesn’t work as well. I’ve imported ‘DSCoreNodes’ but it doesn’t still work at all. So can you guys help me with this?Thanks guys

Please post your preformatted code so that one of the python gurus can edit rather than have to build from scratch. Thanks!

@hcmutkhanghaxuan have look here:

1 Like

import clr
clr.AddReference(‘ProtoGeometry’)
from Autodesk.DesignScript.Geometry import *
clr.AddReference(‘DSCoreNodes’)
from DSCore import *
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
a=[1,1,1,2,3]
#Assign your output to the OUT variable.
OUT = del a[1]

Here is my code, can you guys help me find errors in my code?

a=[1,1,1,2,3]
del a[1]

OUT = a
2 Likes

It works, thanks so much salvatoredragotta.

2 Likes

@hcmutkhanghaxuan :+1:

Mark as solved please