简体   繁体   English

如何访问 ndjson 文件并找到该国最年长的人、平均年龄、最年轻的人。 是否可以仅使用 python 或 javascript

[英]How to access a ndjson file and find the oldest person, average age, youngest person in the country. Is it possible with python or javascript only

在此处输入图像描述

Is it possible to open with python or javascript if so, how do I access the file and find the data I want.是否可以使用 python 或 javascript 打开,如果可以,我如何访问该文件并找到我想要的数据。

You just do it, line by line.您只需逐行执行即可。

import json
data = []
for line in open('ndjson.json'):
    data.append( json.loads(line) )

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获取数组中最年轻和最年长的人 JavaScript - Getting the youngest and oldest person of an Array JavaScript 如何使用 javascript 在 People Array 中找到最年长的人 - How to find the oldest person in People Array using javascript 如何获取此数组中最年长的人 - How to get the oldest person in this array 根据年龄对分类人员进行 html 和 javascript - make an html and javascript to classified person based on their age 如何使用力矩js计算人员的年龄? - how to calculate the age of person using moment js? 我如何将此{'person':{'name':'cc','age':12}}转换为{'person.name':'cc','person.age':12}? - how can I trans this {'person': {'name': 'cc', 'age': 12} } to {'person.name': 'cc', 'person.age': 12}? 使用 TypeScript (JavaScript) 检查一个人今年是否达到特定年龄 - Checking if a person is turning a specific age this year with TypeScript (JavaScript) Trello API访问仅适用于一个人 - Trello API access works for only one person 如何使用他输入的 DOB 存储人的年龄但它不起作用 - How to store the age of the person using his DOB entered but it's not working 显示文件中人员姓名的javascript元素 - javascript element to display name of person from file
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM