import boto3 client = boto3.client('s3') paginator = client.get_paginator('list_objects') for result in paginator.paginate(Bucket='edsu-test-bucket', Delimiter='/'): for prefix in result.get('CommonPrefixes'): print(prefix.get('Prefix'))