with openBenchmarkcommandsjson r as f data = jsonloadf num_elements = lendata print num_elements用 Python 复现
这段代码的功能是读取文件"./Benchmark/commands.json"中的数据,并计算其元素个数,最后输出结果。
复现代码如下:
import json
with open('./Benchmark/commands.json', 'r') as f:
data = json.load(f)
num_elements = len(data)
print(num_elements)
注意,Python3中print语句要加上括号。
原文地址: https://www.cveoy.top/t/topic/hf89 著作权归作者所有。请勿转载和采集!