import boto3
s3 = boto3.client('s3')
csv_records = ['"name","date"',
'"ankan","2021-12-02 14:02:40"']
body = "\n".join(csv_records)
body = str.encode(body)
s3.put_object(Bucket=bucket_name, Key=path, Body=body)
After running this code snippet, the csv (path variable has csv location dw) generated on S3 is containing the date like “2021-12-02 14:02”. Somehow, the rest of the date after the colon is not there at all.
I’ve tried debugging with and without using the str encode, but nothing works. The date is getting messed up, and it’s occurring only with the date field.
What to do here?