我有一行:
row = {'A':'valueA', 'B':'valueB', 'C':'valueC'}
基本上我想打开一个新csv文件并在其列中写入每个值,例如
---------------------------
| A | B | C |
---------------------------
| ValueA | ValueB | ValueC |
---------------------------
我正在这样做:
def OandWtonew(filename, row):
with open('Ouput1.csv', 'wt') as csvfile:
fileout = csv.writer(csvfile, delimiter=' ', quotechar='|', quoting=csv.QUOTE_MINIMAL)
fileout.writerow(row)
但我得到的输出是:
--------------------------------------------
| A | B | C |
--------------------------------------------
| 'A':'valueA' | 'B':'valueB' | 'C':'valueC'|
--------------------------------------------
一只斗牛犬
森林海
相关分类