Download the value of the returned json file to the file

the json returned by requests is in the form of dictionary data: [{aburel _ 1}, {aburel _ 2}, {ab _ 2}.], how to download the values of all ab columns into csv files in turn and save them in two columns.

Oct.27,2021

for item in data:
    with open('test.csv', 'w') as f:
        f.writeline('${},${}\n'.format(item[a],item[b]))

has not been verified, but it is almost meaningful


pandas has a read_json function, which can read the json string whose orient is records into the data frame and save it as a csv file in to_csv. You can try.

Menu