我在班级中调用变量时遇到问题。我已将所有内容都设置为自己的内容,但我仍然遇到错误。我想我很难弄清楚这一点,因为我是 3.0 脚本的新手。
这是我的脚本:
这是错误:
command = 'tcpdump -c5 -tttt -w {0} host {1}'.format(raw, input_host)
NameError: global name 'raw' is not defined
Run Code Online (Sandbox Code Playgroud)
如果我让它们 self.raw 或 self.input_host
它得到这个:
command = 'tcpdump -c5 -tttt -w {0} host {1}'.format(self.raw, self.input_host)
AttributeError: 'MainLoop' object has no attribute 'raw'
Run Code Online (Sandbox Code Playgroud)
command = 'tcpdump -c5 -tttt -w {0} host {1}'.format(raw, input_host)
Run Code Online (Sandbox Code Playgroud)
应该:
command = 'tcpdump -c5 -tttt -w {0} host {1}'.format(self.raw, self.input_host)
Run Code Online (Sandbox Code Playgroud)
请注意self.
| 归档时间: |
|
| 查看次数: |
452 次 |
| 最近记录: |