小编Syn*_*rik的帖子

用于 google colab 的代码格式化程序,如 nb_black

我知道对于 jupyter notebooks 和 jupyter lab,有可用的代码格式化程序扩展,例如nb_blackblackcellmagic. 但是,当我安装它们时,它似乎不适用于 google colab。

您知道 colab 中是否有任何本机选项或格式化代码的扩展程序(符合 pep8)?

pep8 google-colaboratory python-black

47
推荐指数
3
解决办法
2192
查看次数

Comparing empty list from JSON to an empty list

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 …

javascript json node.js

2
推荐指数
1
解决办法
54
查看次数