Sidhant Bansal added the comment:
Hi Remi,
I understand your concerns with the current approach to resolve this issue.
I would like to propose a new/different change to the way `csv.writer` works.
I am putting here the diff of how the updated docs
(https://docs.python.org/3/library
Sidhant Bansal added the comment:
Hi Remi,
Currently a code like this:
```
with open("abc.csv", "w", encoding='utf-8') as f:
data = [b'\x41']
w = csv.writer(f)
w.writerow(data)
with open("abc.csv", "r") as f:
r
Sidhant Bansal added the comment:
Yes, I do recognise that the current doc states that csv only supports strings
and numbers.
However the use case here is motivated when the user wants to write bytes and
numbers/strings mixed to a CSV file. Currently providing bytes to write to a
CSV
Change by Sidhant Bansal :
--
keywords: +patch
pull_requests: +19634
stage: -> patch review
pull_request: https://github.com/python/cpython/pull/20371
___
Python tracker
<https://bugs.python.org/issu
Sidhant Bansal added the comment:
The following code
```
import csv
with open("abc.csv", "w") as f:
data = [b'\xc2a9', b'\xc2a9']
w = csv.writer(f)
w.writerow(data)
```
writes "b'\xc2a9',b'\xc2a9'" in "abc.cs
New submission from Sidhant Bansal :
The following code
```
import csv
with open("abc.csv", "w") as f:
data = [b'\xc2a9', b'\xc2a9']
w = csv.writer(f)
w.writerow(data)
```
writes "b'\xc2a9',b'\xc2a9'" in "abc.cs