问题描述
Map params=getQueryMap(querystring);
String id=(String)params.get("id");
String anotherparam=(String)params.get("anotherparam");
尝试将此字典d = {"a":"a1234","b":"b5678","c":"c4554545"}
转换为d
,如下所示
xml
代码:
<?xml version="1.0" encoding="UTF-8" ?>
<test>
<a>a1234</a>
<b>b5678</b>
<c>c4554545</c>
</test>
尝试在xml输出上方进行打印,并进行漂亮的打印,但最终在from dicttoxml import dicttoxml
xml = dicttoxml(d,custom_root='test',attr_type=False)
# Above 'xml' is of type bytes here
xml = xml.decode("utf-8") # Converting bytes to string
print(xml) # prints,<?xml version="1.0" encoding="UTF-8" ?><test><a>a1234</a><b>b5678</b><c>c4554545</c></test>
以下获得了
(excludes <?xml version
如何漂亮地打印如下内容?
<test>
<a>a1234</a>
<b>b5678</b>
<c>c4554545</c>
</test>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)