Huong Dan Crack Vietmap Cho 25 Mahnic
- goldbilloislimhust
- May 13, 2022
- 1 min read

01e38acffe
AutoData Mobile apps help you track your vehicle, keep you informed about the status of your car, and alert you of dangerous conditions on the road. Updates Data.Q:
How to convert a complex array to csv format?
I want to write data to a CSV file:
import csv
import json
from pymongo import MongoClient
from bson import json_util
# connect to server
client = MongoClient()
db = client.digitecdb
# list all the products in a collection
cursor = db.products.find()
# store the results in a list
results = []
for item in cursor:
# get a single row of data
print item['name']
# write the data to a CSV file
with open('c:\temp\digitecdb.csv', 'w', newline='') as csvfile:
writer = csv.writer(csvfile, delimiter=',')
writer.writerow(["name", "type", "price", "special_price", "image_file", "description", "saleprice"])
for row in results:
# write each row as a row in the CSV file
writer.writerow(row)
Problem:
The content of result is like this:
[ { _id: 514fb53412e4420150e4023e,
name: 'Brand',
type: 'Brand',
price: '1',
special_price: '0',
image_file: 'digitecdb_id1.jpg',
description: 'This is digitecdb',
saleprice: '0' },
{ _id: 514fb4df12e4420150e4023f,
name: 'Brand 2',
type: 'Brand',
price: '1',
special_price: '0',
image_file: 'digitecdb_id2.jpg',
description: 'This is digitec
Related links:
Σχόλια