Jump to content

python list in python expression


vbk!!!

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
 

 

Link to comment
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 ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...