Python学习笔记(9)~Vscod运行Python时报错:Unused import lt from wildcard importpylint(unused-wildcard-import)

错误详情

源代码

#!/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

猜你喜欢

转载自blog.csdn.net/weixin_44225182/article/details/107749419
今日推荐