我知道对于 jupyter notebooks 和 jupyter lab,有可用的代码格式化程序扩展,例如nb_black或blackcellmagic. 但是,当我安装它们时,它似乎不适用于 google colab。
您知道 colab 中是否有任何本机选项或格式化代码的扩展程序(符合 pep8)?
I am trying to check in JavaScript if a value from a json is an empty list or not. I tried obviously json.bundleProductSummaries != []. This doesn't work, however this works:
JSON.stringify(json.bundleProductSummaries) != JSON.stringify([])
Run Code Online (Sandbox Code Playgroud)
My json :
{
"bundleProductSummaries": [
]
}
Run Code Online (Sandbox Code Playgroud)
My code :
fs = require('fs')
body = fs.readFileSync('./json.txt',{encoding : 'utf-8'})
// ---- Parsing de body ----
let json = JSON.parse(body);
let colored = null;
if(json.bundleProductSummaries != []){
json = json.bundleProductSummaries[0];
}
Run Code Online (Sandbox Code Playgroud)
Thank you for your future answers …