字节数据未正确转储到python中的CSV文件中

时间:2019-02-15 18:15:23

标签: python-3.6

我有以下格式的数据 b'1726数字答录机,Luke Weiss,24576,24.56,20.99,4.81,不列颠哥伦比亚省,电话与通信,0.58'

b'DAX Clear Channel Poster Frame,Luke Weiss,24576,38.02,14.58,7.4,British Columbia,Office Furnishings,0.48'
b'"80 Minute Slim Jewel Case CD-R , 10/Pack - Staples",Christina Vanderzanden,25248,29.21,8.33,1.99,British Columbia,Computer Peripherals,0.52'
b'Xerox 1891,Christina Vanderzanden,25248,418.19,48.91,5.81,British Columbia,Paper,0.38'

我想将以下数据转储到CSV文件中,转储后的数据完全不同,我只能在CSV文件中看到整数。

这是我的代码

with open('/tmp/demo.csv', 'w', newline='') as f:
            writer = csv.writer(f)
            for row in x:
              print(row)
              writer.writerow(row)
            s3.upload_file("/tmp/demo.csv","sample-bucket", "some_file.csv")

0 个答案:

没有答案