我正在尝试使用此代码加入2个字符串:
def __get_temp(self):
return float(self.ask('RS'))
def __set_temp(self, temp):
set = ('SS' + repr(temp))
stat = self.ask(set)
return self.check(stat)
temp = property(__get_temp, __set_temp)
Run Code Online (Sandbox Code Playgroud)
一旦合在一起,我就会使用PyVisa通过串行总线发送信号.但是,当我尝试调用该函数时,我得到了
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
chil.temp(13)
TypeError: 'float' object is not callable
Run Code Online (Sandbox Code Playgroud)
我试过四处寻找这个错误的解释,但没有一个是有道理的.有谁知道发生了什么?
看起来你正试图设置属性temp,但你实际做的是获取属性,然后尝试使用参数13将其作为函数调用.设置的语法是:
chil.temp = 13
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5527 次 |
| 最近记录: |