Convert python list to integers in grasshopper

This answer must be buried somewhere but I have been unable to find it…
my python script in grasshopper outputs a list of numbers eg [1,2,5,8,9] and I am trying to use this list as a series of radius values for circles. How do I get GH to interpret this list as numbers rather than a string of text so that I can output it to any input that requires numbers ?

I’m not sure I understand your problem here…

thank you so much …."print(type(a[0]))” is what I was looking for

where to bend next……

That line is just to show that gh_python detects the list as a list of integers… It doesn’t change what’s inside of the list.

Yes, I understand that now and it enables me to play around with lists instead of using expressions in GH
thanks again, Giusseppe

where to bend next……

I am not sure why the same approach does not work here…the same script run in rhino produces the x,y,z components as a list but they don’t show up in GH

and if I indent the print request then I only get this…

And if I just use print(a) I am back to the problem of GH treating the list as text not points, and the only way I seem to be able to achieve that is by removing the brackets in the list which seems such a rough approach.

Hi @giusseppe,
You need to set the list of points to the output parameter a. you are currently assigning a list of numbers, and the points aren’t being returned to grasshopper (they are just being created in memory)

had a play and added some more inputs. I’ve commented the code and separated the steps out to make it clearer. I hope this helps (6.9 KB)

help a lot …thanks
my python script was as simple as I had shown in the picture but my GH was way too crude as a consequence…thanks to you I can tidy that up now instead of what I show here…I had also been playing with the inputs to the python tool in order to generate less symmetrical shapes.

random (23.5 KB)