I want to do 3 things with the following code. But I'm newb to python 3 (and python in general).
- Remove the beginning and ending brackets
- remove the commas
- put each entry on it's own line
Here is the code so far:
import boto3
# Create an S3 client
s3 = boto3.client('s3')
# Call S3 to list current buckets
response = s3.list_buckets()
# Get a list of all bucket names from the response
buckets = [bucket["Name"] for bucket in response['Buckets']]
# Print out the bucket list
print("Bucket List: %s" % buckets)
Here is my output from the above code:
Bucket List: ['aws-ip-update-01', 'aws-ip-update-02', 'aws-ip-update-bucket', 'case4667772691-cloudtraillogs', 'cf-templates-10gcjonooe0lj-us-east-1', 'config-bucket-832839043616', 'fsaas', 'company-aws-config', 'company-cloudtrail-nonprod', 'company-dev', 'company-isam9', 'company-netbackup-nonprod', 'company-timd-test-bucket', 'kpmgimagedeploy', 'ussvcsplunkaws-nonprod-keys']
How can I achieve these 3 things?