xml2dict¶
- tifffile.xml2dict(xml, /, *, sanitize=True, prefix=None, sep=',')¶
Return XML as dictionary.
- Parameters:
xml (str) – XML data to convert.
sanitize (bool) – Remove prefix from from etree Element.
prefix (tuple[str, str] | None) – Prefixes for dictionary keys.
sep (str) – Sequence separator.
- Return type:
dict[str, Any]
Examples
>>> xml2dict( ... '<?xml version="1.0" ?><root attr="name"><key>1</key></root>' ... ) {'root': {'key': 1, 'attr': 'name'}} >>> xml2dict('<level1><level2>3.5322,-3.14</level2></level1>') {'level1': {'level2': (3.5322, -3.14)}}