我最近开始学习python。我使用 vscode,我真的很讨厌 vscode 中的默认变量颜色(白色),我想将其更改为彩色的。我尝试在网上搜索,大多数人都说要在settings.json. 我不知道怎么办。
编辑:我编辑了settings.json这个
{
"python.pythonPath": "c:\\Users\\Kakshipth\\Documents\\coding\\py\\virtualauto\\Scripts\\python.exe",
"code-runner.respectShebang": false,
"editor.tokenColorCustomizations": {
"variables": "#1100ff"
},
}
Run Code Online (Sandbox Code Playgroud)
但变量的颜色仍然没有改变
我是 js 的新手,我正在学习 Promise。我想出了这段代码,它将打印每个函数的解析值,并使用.then
function login() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve({username : 'default'})
}, 1000)
})
}
function getVideos() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve(['vid1', 'vid2'])
},1000)
})
}
function getDesc() {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve('desc')
}, 1000)
})
}
const test = login()
test.then(res => {
console.log(res)
getVideos()
})
.then(res => {
console.log(res)
getDesc()
})
.then(res => console.log(res))
Run Code Online (Sandbox Code Playgroud)
但是,我没有得到预期的结果,我认为.then()需要执行所有语句并决定继续下一个 …