将文件保存到 Azure Blob 存储中

Saving a file into Azure Blob storage

我是 运行 Azure 机器学习 platform/cloud 的 Python 代码,但我不知道如何将生成的数据帧保存到 Azure Blob 存储中的 csv 文件中。谁能告诉我怎么做,或者告诉我在哪里可以阅读更多相关信息?

您能否尝试使用以下 python 代码将文件上传到 Azure 博客:

global service_client

service_client = DataLakeServiceClient(account_url="{}://{}.dfs.core.windows.net".format("https", 'Storage_account_name'), credential='Storage_Account_Key')

#upload file to ADLS Gen 2
file_system_client = service_client.get_file_system_client(file_system="your_container_name")

directory_client = file_system_client.get_directory_client("my-directory")

file_client = directory_client.create_file("uploaded-file.txt")
local_file = open("C:\Users\xxxxxxx\Desktop\testFile.txt", 'r')

file_contents = local_file.read()

file_client.append_data(data=file_contents, offset=0, length=len(file_contents))

file_client.flush_data(len(file_contents))

有关完整代码的更多详细信息,请访问 this link