Jump to content
vbk!!!

python list in python expression

Recommended Posts

Hello,

 

I have a node parameter with  a little expression to allow me to get a list of strings.

Now, in another node, I would like to write a new expression returning a specific component of the previously created list.

But I can't get it to work.

ch('myNodePath') : return the list

len(ch('myNodePath')) : return the lengthof the list
ch('myNodePath')[0] : return a bracket instead of the first component :(

 

Thanks for your help
 

 

Share this post


Link to post
Share on other sites

my guess is that your list is actually a string that looks like a list.  try putting eval() around it prior to trying to pull the first index.

Share this post


Link to post
Share on other sites

my guess is that your list is actually a string that looks like a list.  try putting eval() around it prior to trying to pull the first index.

My guess too.

 

Are you shure this expresion :

len(ch('myNodePath'))

is returning the correct length of items and not the length of string ?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×