正在尝试解析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存储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的更好方法
如果您想从Azure blob读取xml文件,我们可以使用包
azure.storage.blob
来实现它比如说
我的xml文件
相关问题 更多 >
编程相关推荐