[英]Upload PDF to Azure Data Lake store Gen2
我无法使用 Python SDK 将 PDF 上传到数据湖。 过去有人试过吗?
请尝试以下代码:
try:
client = DataLakeServiceClient.from_connection_string(conn_str=my_connection_string)
file_system_client = client.get_file_system_client(file_system_name)
directory_client = file_system_client.get_directory_client(file_name)
file_client = directory_client.create_file("test.pdf")
f = open(local_path,'rb')
file_contents = f.read()
file_client.upload_data(file_contents, overwrite=True)
f.close()
except Exception as e:
print(e)
它对我有用。希望这可以帮助你。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.