一.自动输出中文字符集 select * from db into outfile 'test.csv' CHARACTER SET gbk fields terminated by ',' optionally enclosed by '"' escaped by '"' lines terminated by '\r\n'; 二.导出后转换字符集 转换成CSV文件,如果乱码将CSV已记事本打开另存为UTF8 select * from db into outfile 'test.c
1.写入excel,一开始不需要自己新建一个excel,会自动生成 attribute_proba是我写入的对象 import xlwt myexcel = xlwt.Workbook() sheet = myexcel.add_sheet('sheet') si=-1 sj=-1 for i in attribute_proba: si=si+1 for j in i: sj=sj+1 sheet.write(si,sj,str(j)) sj=-1 myexcel.save("attribut
import csv import pandas as pd ###csv.reader用法 ''' f=open(r"C:\Users\admin\pycdtest\wanyue\yueeceshi.csv") readeriter=csv.reader(f) for line in readeriter: print(line) ''' lines=list(csv.reader(open(r"C:\Users\admin\pycdtest\wanyue\yueecesh
导出到json: $ mongoexport.exe -d TestDB -c TestCollection -o ./test.json 导出到csv: If you want to output CSV, you have to specify the fields in the order you want them. $ mongoexport.exe --csv -f _id,f1,f2,f3,f4,f5,f6,f7 -d TestDB -c TestCollection -o