Python Script From String - Code Block Error

Hi All,

If I try to insert the python code below in a code block a get an error. It runs okay in a Python Script node.

is there a solution?

Thanks.

OUT =["Span " + str (i) + " " + “On_Off” for i in range(1,11)]

It’s because of the double quotes . Try this :
“OUT =['Span ’ + str (i) + ’ '+ ‘On_Off’ for i in range(1,11)]”

5 Likes

@Mostafa_El_Ayoubi

Thanks that worked! :grinning:

@salvatoredragotta @Mostafa_El_Ayoubi is right