安装pymssql保存到csv

 直接用pip install pymssql 安装 ,报错:
Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
从google上查到别人的解决方案是 下载第三方的whl
http://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql
之后 pip instal XXX.whl
OK了。

 

 

包:  csv
核心代码:
with open ("test.csv", "w", newline='') as f :       #newline参数控制行之间是否空行
    f_csv = csv.writer(f)
    f_csv.writerow(headers)   # headers为表头属性名组成的数组
    f_csv.writerows(csvlists)   #csvlists为多维数组,每个元素都是对应属性的一行内容

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章