Я пробовал этот код, чтобы получить указанные строки из файла csv ....
import csv
import json
print("Content-type:text/html\r\n\r\n")
with open("data.csv") as f:
fieldnames = ("Nucleotide_Name","Ethnicity",
"Disease_type_of_the_subject","Type_of_study")
reader = csv.DictReader(f,fieldnames)
for row in reader:
print(json.dumps(row))
мой ожидаемый результат
{"Nucleotide_change":39510,"Ethnicity:88qe78q,"Disease_type_of_the
_subject":"phnotype","type_of_study":"tramsmission"}
, но он возвращает все строки из этого csv файл ...
{"Ethnicity": "Amino acid change", "Type_of_study": "Mutation type",
"Disease type of the subject": "Nucleotide Change", "Nucleotide_Name":
"Gene Location", "null": ["Functional prediction", "Ethnicity ",
"Disease type of the subject", "Total number of subjects ", "Total
number of subjects with specific mutaiton", "Control case", "Control
case with specific mutation", "Disease association with Mutation",
"Type of study", "Pubmed ID"]}
{"Ethnicity": "Leu", "Type_of_study": "Disease causing mutation",
"Disease type of the subject": "c.1064_1076del", "Nucleotide_Name":
"", "null": ["Premature truncation", "Caucasian (U.S./Spain)", "PCG",
"7(families)", "2", "0", "0", "Associated with phenotype", "Family
based", "27777502"]}
требуется руководство ..