Reading binary data with the CSV module

Jason Friedman jsf80238 at gmail.com
Sun Nov 29 22:59:48 EST 2020


>
> 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 less
memory?

for row in
csv.DictReader(source_file.content().decode('utf-8').splitlines()):
    print(row)


More information about the Python-list mailing list