I currently try to understand the import io
.
1) What I still didn't figure out what happens in the variable buffer_2
. Why is that step necessary?
2) I couldn't figure out what the default delimiter
is for csv.writer
. Is it necessary to set this parameter?
buff = io.StringIO()
writer = csv.writer(buff, dialect='excel', delimiter=',')
writer.writerow(["a", "b", "c"])
buffer_2 = io.BytesIO(buff.getvalue().encode())
# Updated code sample here
BUCKET_NAME = 'fbprophet'
OBJECT_NAME = 'blah.csv'
s3.upload_fileobj(buffer_2, BUCKET_NAME, OBJECT_NAME)