错误详情
源代码
#!/usr/bin/python3
from operator import *
def calculator(a, b, k):
return {
'+': add,
'-': sub,
'*': mul,
'/': truediv,
'**': pow
}[k](a, b)
# 1+2=3
print(calculator(1, 2, '+'))
# pow(3,4)=81
print(calculator(3, 4, '**'))
警告⚠️【代码是可以运行的】
Unused import lt from wildcard importpylint(unused-wildcard-import)
解决方案
在setting.json中加入
"python.linting.pylintArgs": [ "--disable=C,R,W" ]
警告就没有了
参考资料
https://code.visualstudio.com/docs/python/linting