PyChram 中未使用的导入语句“导入请求" [英] Unused import statement 'import requests' in PyChram
问题描述
我写道:import requests
- 在我的代码中没有添加任何其他内容,并且该行以灰色突出显示.
PyCharm 本身让我删除该行,但我需要它.
看到了一种添加方法:#noinspection Py Unresolved References - 但是没有它有可能吗?
灰线截图
I wrote: import requests
- in my code without adding anything else, and this line is highlighted in gray.
PyCharm itself offered me to delete the line, but I need it.
Saw a way with adding:
#noinspection Py Unresolved References - but is it possible somehow without it?
screenshot of gray line
推荐答案
如果您没有使用 requests 模块的任何功能,PyCharm 将向您显示警告或错误,因为您将其加载到您的内存中而您没有需要它,但如果您以后要使用它,则可以忽略它.
If you aren't using any functions of the requests module PyCharm will show you a warning or error, because you load it in your memory and you don't need it, but if you are working with it later, you can just ignore it.
这篇关于PyChram 中未使用的导入语句“导入请求"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!