python import xmltodict xml_data = """ <book> <title>Harry Potter and the Philosopher's Stone</title> <author>J.K. Rowling</author> </book> """ book_dict = xmltodict.parse(xml_data) print(book_dict) {'book': {'title': "Harry Potter and the Philosopher's Stone", 'author': 'J.K. Rowling'}}


上一篇:
下一篇:
切换中文