Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/json/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 2.7 python2.7的str(getattr(platfrom,'node')())中()的函数是什么?_Python 2.7 - Fatal编程技术网

Python 2.7 python2.7的str(getattr(platfrom,'node')())中()的函数是什么?

Python 2.7 python2.7的str(getattr(platfrom,'node')())中()的函数是什么?,python-2.7,Python 2.7,Python是2.7.11,终端是powershell 在下面运行时: >>> import platform >>> str(getattr(platform,'node')()) 'CN00054688' >>> str(getattr(platform,'node')) '<function node at 0x0000000002E74908>' 内部str似乎有不同的输出 为什么?这是你在什么地方看到的东西吗?

Python是2.7.11,终端是powershell

在下面运行时:

>>> import platform

>>> str(getattr(platform,'node')())

'CN00054688'

>>> str(getattr(platform,'node'))

'<function node at 0x0000000002E74908>'
内部str似乎有不同的输出


为什么?

这是你在什么地方看到的东西吗?这是没有意义的东西写;你只需要做platform.node.>>>strgetattrplatform,'node'是这样的。当第一个是可调用对象时,str中的第二个函数是什么?似乎理解一些:strgetattrplatform,'node'==strplatfrom.node和strgetattrplatfrom,'node'==strplatfrom.node如此不同的输出。当然,它调用了可调用对象。