my python function was supposed to merely print variables from a multitude of functions into a single line, but Target.get_target_type is outputting as something I don't really understand so I have no idea how to fix it. The expected output was a string literal of 'x' or 'y'.
The output:
Target behavior: <function Target.get_target_type at 0x102d89620> Pursuer behavior: X Mis-Match
from function:
def interaction_report(self):
print("Target behavior: \t", Target.get_target_type, "Pursuer behavior: \t", self.pursue_type, "\t", self.match_string)
refers to:
def get_target_type(self):
return self.__target_type
您实际上需要调用函数(例如Target.get_target_type()
而不是Target.get_target_type
。如果不调用它,那么最终只能引用可调用函数对象本身。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.