所以你可以删除它们,什么都不会改变。消息告诉你这件事,因为有这样的代码是很不寻常的。 我想你想要这个: def percent(marks): return (marks[0]+marks[1]+marks[2]+marks[3]/400)*100 marks1 = [54, 65, 85, 54] percent1 = percent(marks1) marks2 = [54, 52, 65, 85] percent2 = percent...
The Python warning that code is unreachable occurs when you return a value from a function and try to run more code after the function has returned.
I have python installed and I have pythonPath set, but whenever I open a python project folder I get this popup I get the poput even though I already opened this project previously in VSCode. And even more weird is that I just had a proj...
~/.vscode/extensions/ms-python.python-2019.8.29288/pythonFiles > /usr/bin/python3 -m pylint --disable=all --enable=F,unreachable,duplicate-key,unnecessary-semicolon,global-variable-not-assigned,unused-variable,unused-wildcard-import,binary-op-exception,bad-format-string,anomalous-backslash-in-strin...
对于遇到这个 Stack Overflow 问题的任何人想知道如何禁用 Pylance 将其(通常错误地)认为无法访问的文本变灰的功能,解决方案由 luabud 在这 条评论 和关于GitHub issue How to disable “code is not reachable”… ,就是在你的用户/工作区 settings.json 文件中加入以下条目: "[python]": { "editor.showUnuse...
I'm not sure if I should post this in a closed post or make a new one but the problem outlined by the OP still exists in my environment even after I switch to Pylance as noted in the fix above. While the code executes, it is irritating to see so many linter errors. ...