有人可以帮我解析一下网页上的特定数据吗?这是网页上的内容。
HttpPostRequestDecoder decoder = new HttpPostRequestDecoder(new DefaultHttpDataFactory(true), req);
InterfaceHttpData data = decoder.next();
我只需要整个内容中的id。请注意我们在网页内容中有两次id,所以我需要网页上的所有ID。这是我为转储Web内容而编写的代码,但无法解析我需要的数据。请帮帮我。
{"sites":[{"id":"XX","name":"YY","url":"ZZ","username":"AA","password":"BB","siteId":"0"},{"id":"XX","name":"YY","url":"ZZ","username":"AA","password":"BB","siteId":"0"}]}
答案 0 :(得分:0)
您的内容是一个json文档,您可以使用json library对其进行解析并将其用作python对象:
def doMyStuff(self):
<get a self.file_list>
self.num_completed = 0
self.threads = []
self.workers = []
for f in self.file_list:
w = Worker(f)
w.done.connect(self.update_this)
thread = QThread()
w.moveToThread(thread)
thread.started.connect(w.process)
thread.finished.connect(self.thread_complete)
self.threads.append(thread)
self.workers.append(worker)