Re: Reading binary data with the CSV module

2020-11-30 Thread MRAB
On 2020-11-30 03:59, Jason Friedman wrote: csv.DictReader appears to be happy with a list of strings representing the lines. Try this: contents = source_file.content() for row in csv.DictReader(contents.decode('utf-8').splitlines()): print(row) Works great, thank you! Question ... wil

Re: Reading binary data with the CSV module

2020-11-29 Thread Jason Friedman
> > csv.DictReader appears to be happy with a list of strings representing > the lines. > > Try this: > > contents = source_file.content() > > for row in csv.DictReader(contents.decode('utf-8').splitlines()): > print(row) > Works great, thank you! Question ... will this form potentially use l

Re: Reading binary data with the CSV module

2020-11-29 Thread MRAB
On 2020-11-30 01:31, Jason Friedman wrote: Using the Box API: print(source_file.content()) returns b'First Name,Last Name,Email Address,Company,Position,Connected On\nPeter,van (and more data, not pasted here) Trying to read it via: with io.TextIOWrapper(source_file.content(), encoding=

Reading binary data with the CSV module

2020-11-29 Thread Jason Friedman
Using the Box API: print(source_file.content()) returns b'First Name,Last Name,Email Address,Company,Position,Connected On\nPeter,van (and more data, not pasted here) Trying to read it via: with io.TextIOWrapper(source_file.content(), encoding='utf-8') as text_file: reader = csv.DictRead