How can I read files in the Azure blob container using Python? Im trying to read some JSON files in container for flattening them.
Im new to Azure and dont have much idea about this. I could connect to the container using "BlobServiceClient". But, Im not sure how to read the files from a folder in teh container
Thanks
If you want to read a file from Azure blob with python, please refer to the following code
from azure.storage.blob import BlobServiceClient
connection_string=''
blob_service_client = BlobServiceClient.from_connection_string(connection_string)
container_client = blob_service_client.get_container_client("<container name>")
blob_client = container_client.get_blob_client("<blob name>")
blob_client.download_blob().readall() # read blob content as string
For more details, please refer to the document
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.