[issue1537721] csv module: add header row to DictWriter
Dirkjan Ochtman
report at bugs.python.org
Thu Mar 4 19:48:24 CET 2010
Dirkjan Ochtman <dirkjan at ochtman.nl> added the comment:
Testing on Windows with this:
Index: Lib/test/test_csv.py
===================================================================
--- Lib/test/test_csv.py (revision 78430)
+++ Lib/test/test_csv.py (working copy)
@@ -9,6 +9,7 @@
import tempfile
import csv
import gc
+import io
from test import test_support
class Test_Csv(unittest.TestCase):
@@ -595,7 +596,7 @@
### "short" means there are fewer elements in the row than fieldnames
def test_write_simple_dict(self):
fd, name = tempfile.mkstemp()
- fileobj = os.fdopen(fd, "w+b")
+ fileobj = io.open(fd, 'w+b')
try:
writer = csv.DictWriter(fileobj, fieldnames = ["f1", "f2", "f3"])
writer.writeheader()
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1537721>
_______________________________________
More information about the Python-bugs-list
mailing list