i am trying to apply a Python Script to a dynamo graph that creates an integer based on a text parameter. The problem is that some of the elements i am using have a text parameter called “rentable” while other have a text parameter called “not rentable”. Dynamo creates the same integer for both strings (maybe because both contain the word “rentable”?)
list = IN[0]
newlist =
for x in list:
if “rentable” in x:
newlist.append(1)
elif “not rentable” in x:
newlist.append(2)
else:
newlist.append(3)
Yup, in basically means “can be found in”. It will search for items in a list or substrings within a string, so you have to be careful how you use it. As the others have mentioned you’ll want to check if the string “is equal to” (==).