I have created the following variable, which captures the function from a Point object I created:
j = i.getfunction()
print(j)
The print(j) outputs something like this whenever it's called:
<function draw_H at 0x1057ce268>
What I want to do is find out if the item attached to the variable contains certain words. For instance, using the print(j) output above, I want to find out if j contains draw_H, like so:
if j contains draw_H:
# Run this code
How would I do this? Specifically, how would I find out if an item attached to a variable contains a certain word? Any help is greatly appreciated!
draw_His not value. Function<function draw_H at 0x1057ce268>is value attached to variable.draw_His name of function attached to variable.j.__name__ == "draw_H"if "draw_H" in j.__name__:.j.__name__is a string so you can use other string functions.