给定的有xml文件,在该xml文件中可以获得name image_list等数据,现在需要将这些数据按照问题中的格式写入日志中。现在是用python处理xml文件,我考虑用json格式化数据,但json格式化的数据形式是:
{
"name":"peter",
"image_list" :[
{
"src":"http://www.abc.com/1.jpg",
"href":"#"
}
]
}
请问应该如何操作才能获得标题中所给定的格式?
Stupid way:
Get name value
Get image_list value
The format of this thing is actually output by PHP. It is best to use PHP. I guess you know it. I just want to show you the implementation. The principle is the same, which is callback