I am new to python and am trying to list all the files under s3 directory. I have done this before in databricks using
%sh ls path
I want to understand if there is any similar command available for python- using jupyter based on aws ec2 instance.
I was able to do this using boto3 but I want to understand if there is a simpler way of doing this**(similiar to %sh ls path on databricks)**
import boto3
s3 = boto3.resource('s3')
my_bucket = s3.Bucket('data')
for my_bucket_object in my_bucket.objects.all():
print(my_bucket_object)