在vscode编写字典使用dict.get()时,出现未定义的错误
a = ["Mike","Jack","John"]
b = ["85","88","90"]
math = dict(zip(a,b))
print("math:",math)
art = dict(Mike = "90",Jack = "85",John = "86")
print("art :",art)
print("Bob:",dict.get(Bob["These is no Bob"]))
[{
"resource": "/C:/Users/JSY/Desktop/py/test.py",
"owner": "_generated_diagnostic_collection_name_#2",
"code": {
"value": "reportUndefinedVariable",
"target": {
"$mid": 1,
"external": "https://github.com/microsoft/pylance-release/blob/main/DIAGNOSTIC_SEVERITY_RULES.md#diagnostic-severity-rules",
"path": "/microsoft/pylance-release/blob/main/DIAGNOSTIC_SEVERITY_RULES.md",
"scheme": "https",
"authority": "github.com",
"fragment": "diagnostic-severity-rules"
}
},
"severity": 4,
"message": "\"Bob\" is not defined",
"source": "Pylance",
"startLineNumber": 9,
"startColumn": 23,
"endLineNumber": 9,
"endColumn": 26
}] 在VS中使用dict.get(key[,default]),其中的逗号添加后会报错
显示我的( 没有闭合 舍命伴君行 发表于 2022-7-30 11:38
在VS中使用dict.get(key[,default]),其中的逗号添加后会报错
显示我的( 没有闭合
代码呢?? art.get("Bob", "no Bob") wp231957 发表于 2022-7-30 16:32
代码呢??
额,新鱼油还不会上传照片{:5_100:}
页:
[1]