如何解决 python 脚本中的 NameError 错误(在 linux CentOS 上)
How to solve the NameError error in a python script ( on linux CentOS)
我正在尝试在 Cent OS 8 上制作一个 Python 脚本,但我经常收到此 'NameError' 消息,但我无法弄清楚可能是什么问题。在这里您会看到我的脚本和错误消息的屏幕截图。
The error message
My script
在此先感谢您的帮助。
您必须像 with open("full path to sshdlog file") as f
一样提及文件“sshdlog”的完整路径,或者您的脚本和 sshdlog 在同一目录中。
我正在尝试在 Cent OS 8 上制作一个 Python 脚本,但我经常收到此 'NameError' 消息,但我无法弄清楚可能是什么问题。在这里您会看到我的脚本和错误消息的屏幕截图。
The error message
My script
在此先感谢您的帮助。
您必须像 with open("full path to sshdlog file") as f
一样提及文件“sshdlog”的完整路径,或者您的脚本和 sshdlog 在同一目录中。