[英]python giving function as output?
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. 我的python函数原本应该只是将多个函数中的变量打印到一行中,但是Target.get_target_type的输出是我不太了解的内容,所以我不知道如何解决。 The expected output was a string literal of 'x' or 'y'.
预期的输出是字符串文字“ x”或“ 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
。如果不调用它,那么最终只能引用可调用函数对象本身。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.