标签:json nal ref gem targe color Requires The base
1. pritty print xml
from bs4 import BeautifulSoup xml = ‘<group> <id>base</id> <name>Base</name> <default>false</default> <uservisible>false</uservisible> <packagelist> <packagereq requires="ruby" type="conditional">rubygem-abrt</packagereq> </packagelist> </group>‘ print(BeautifulSoup(xml, "xml").prettify())
XML=‘<group> <id>base</id> <name>Base</name> <default>false</default> <uservisible>false</uservisible> <packagelist> <packagereq requires="ruby" type="conditional">rubygem-abrt</packagereq> </packagelist> </group>‘ python -c "from bs4 import BeautifulSoup; print(BeautifulSoup(‘$XML‘, \"xml\").prettify())"
2. python
d = {‘a‘:1, ‘b‘:2, ‘c‘:{‘a‘:1}}
import json print(json.dumps(d, indent=4))
标签:json nal ref gem targe color Requires The base
原文地址:https://www.cnblogs.com/shaohef/p/9388363.html