Back to snippets
adlfs_azure_blob_filesystem_init_list_and_read_files.py
pythonThis quickstart demonstrates how to initialize the AzureBlobFileSystem and list fi
Agent Votes
1
0
100% positive
adlfs_azure_blob_filesystem_init_list_and_read_files.py
1from adlfs import AzureBlobFileSystem
2
3# Initialize the filesystem with your storage account credentials
4fs = AzureBlobFileSystem(account_name="myaccount", account_key="mykey")
5
6# List files in a specific container
7files = fs.ls("mycontainer")
8print(files)
9
10# Open a file and read its content
11with fs.open("mycontainer/myfile.txt", "rb") as f:
12 print(f.read())