The problem of saving data in python csv

: {"product": "ninth power big data"}, "" 11 ": {"product":"Crazy paste-Fun"},"12": {"" product ":"Hot Mom Exchange"}, "" 13 ": {" product ":" four Seas Huachen Technology "}," 14 ": {" product ":" Norkang "}," 13 ": {" product ":" Huachen Technology of the four Seas "," 14 ": {" product ":" Nuoerkang "}," 13 ": {" product ":" Huachen Technology of the four Seas "," 14 ": {" product ":" Norcom "}, "15": {"product": "Tianjin pictographic Science and Technology"}, "16": {"product": "Amoy search"}, "17": {"product": "moonbasa"}, "18": {"product": "Rubik"s cube apartment"}, "19": {"product": "Dolly Farm"}, "" 20 ": {" product ":"Mickey"},"21": {"product":"Letou"},"22": {"product":"Oristin"}"

I replace this file in csv with% s / "/" / g (replace two double quotes with a single double quotation mark). Why are there no commas between strings? why is this,-sharp-sharp-sharp topic description

Jun.18,2021

try to replace it in vim in your way. Normal replacement does not reproduce what you said. Guess is related to your vim configuration?

refer to the following example

given a certain format of data, because the json format may be much more complex than csv, only one layer of flat json data is supported:

employee_data = '{"employee_details":[{"employee_name": "James", "email": "james@gmail.com", "job_profile": "Sr. Developer"},{"employee_name": "Smith", "email": "Smith@gmail.com", "job_profile": "Project Lead"}]}'
import json

import csv

employee_parsed = json.loads(employee_data)

emp_data = employee_parsed['employee_details']

-sharp open a file for writing

employ_data = open('/tmp/EmployData.csv', 'w')

-sharp create the csv writer object

csvwriter = csv.writer(employ_data)

count = 0
for emp in emp_data:
  if count == 0:
    header = emp.keys()
    csvwriter.writerow(header)
    count += 1
    
  csvwriter.writerow(emp.values())

employ_data.close()

will output the result, key will form a header, and value will be a comma-separated value

$ cat /tmp/EmployData.csv 
employee_name,email,job_profile
James,james@gmail.com,Sr. Developer
Smith,Smith@gmail.com,Project Lead
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c564-2c333.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c564-2c333.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?