求助,刚学python,有个问题无法解决!
答案:2 悬赏:0 手机版
解决时间 2021-01-11 15:30
- 提问者网友:雨不眠的下
- 2021-01-11 00:57
求助,刚学python,有个问题无法解决!
最佳答案
- 五星知识达人网友:杯酒困英雄
- 2021-01-11 02:09
# -*- coding: utf-8 -*-
import csv
from io import open
g_record = []
a = [1,2,3]
b = [2,5,5]
g_record.append(a)
g_record.append(b)
fd = open("newrecord.csv","wb")
writer = csv.writer(fd)
for line in g_record:
print line
writer.writerow(line)
fd.close()
在python2.6下通过
import csv
from io import open
g_record = []
a = [1,2,3]
b = [2,5,5]
g_record.append(a)
g_record.append(b)
fd = open("newrecord.csv","wb")
writer = csv.writer(fd)
for line in g_record:
print line
writer.writerow(line)
fd.close()
在python2.6下通过
全部回答
- 1楼网友:刀戟声无边
- 2021-01-11 03:05
fd = open("newrecord.csv","w+")
改成
fd = open("newrecord.csv","wb+")
用二进制方式打开就ok了
改成
fd = open("newrecord.csv","wb+")
用二进制方式打开就ok了
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯