python csv module error -
when use pythons csv module, shows me
"delimiter" must 1-character string" my code this
sep = "," srcdata = cstringio.stringio(wdata[1]) data = csv.reader(srcdata, delimiter=sep) wdata[1] string source.
how fix problem?
you have from __future__ import unicode_literals @ top of module or using python 3.x+ need this:
sep=b"," # notice b before " srcdata=cstringio.stringio(wdata[1]) data = csv.reader(srcdata,delimiter=sep) this tells python want represent "," byte string instead of unicode literal.
Comments
Post a Comment