尝试解析 XML BLOB 并将其转换为 CSV。使用本地文件时可以使用以下代码。
import xml.etree.ElementTree as et
SourceFileName = req.params.get('FileName')
SourceContainer = "C:\\AzureInputFiles\\"
SourceFileFullPath = SourceContainer + SourceFileName
xtree = et.parse(SourceFileFullPath)
xroot = xtree.findall(".//data/record")
df_cols=['Col1', 'Col2']
rows = []
在 Azure BLOB 上工作时无法使用。我怎样才能做到这一点 ?不是最干净的,但通过创建带参数的 URL 尝试了以下方式。容器设置为公共访问,Blob 没有限制。使用的库:azure-storage-blob
import xml.etree.ElementTree as et
url = f"https://{account_name}.blob.core.windows.net/{container_name}/{blob_name}"
xtree = et.parse(url)
xroot = xtree.findall(".//data/record")
df_cols=['Col1', 'Col2']
rows = []
有什么建议可以让它发挥作用吗?访问 Blob 的更好方法?
摇曳的蔷薇
相关分类