Я бы хотел распечатать каждую пару значений ключа из словарей, которые вложены в список. Итак, вот с чем я работаю:
[{"updated_at":"2011/09/26 22:39:18 +0000","url":"http://diveintopython.net/http_web_services/redirects.html","annotations":[],"user":"name","shared":"yes","tags":"python,handler,opener,urllib2","readlater":"no","created_at":"2011/09/26 22:39:18 +0000","title":"11.7.\xc2\xa0Handling redirects","comments":[],"desc":""},{"updated_at":"2011/09/26 11:09:07 +0000","url":"http://www.polimex.net/sklep/index.php?page=Category&catid=7","annotations":[],"user":"name","shared":"yes","tags":"plastic,snap,buttons,clothing","readlater":"no","created_at":"2011/09/26 11:05:48 +0000","title":"Polimex - Plastic\xc2\xa0accessories","comments":[],"desc":""}]
Когда я делаю
from pprint import pprint
data = [{"updated_at":"2011/09/26 22:39:18 +0000","url":"http://diveintopython.net/http_web_services/redirects.html","annotations":[],"user":"name","shared":"yes","tags":"python,handler,opener,urllib2","readlater":"no","created_at":"2011/09/26 22:39:18 +0000","title":"11.7.\xc2\xa0Handling redirects","comments":[],"desc":""},{"updated_at":"2011/09/26 11:09:07 +0000","url":"http://www.polimex.net/sklep/index.php?page=Category&catid=7","annotations":[],"user":"name","shared":"yes","tags":"plastic,snap,buttons,clothing","readlater":"no","created_at":"2011/09/26 11:05:48 +0000","title":"Polimex - Plastic\xc2\xa0accessories","comments":[],"desc":""}]
pprint(data)
результат, который я получаю, совпадает с исходным списком, но в строке
'[{"updated_at":"2011/09/26 22:39:18 +0000","url":"http://diveintopython.net/http_web_services/redirects.html","annotations":[],"user":"name","shared":"yes","tags":"python,handler,opener,urllib2","readlater":"no","created_at":"2011/09/26 22:39:18 +0000","title":"11.7.\xc2\xa0Handling redirects","comments":[],"desc":""},{"updated_at":"2011/09/26 11:09:07 +0000","url":"http://www.polimex.net/sklep/index.php?page=Category&catid=7","annotations":[],"user":"name","shared":"yes","tags":"plastic,snap,buttons,clothing","readlater":"no","created_at":"2011/09/26 11:05:48 +0000","title":"Polimex - Plastic\xc2\xa0accessories","comments":[],"desc":""}]'
Как мне сделать так, чтобы распечатка данных выглядела примерно так?
[
{
"updated_at":"2011/09/26 22:39:18 +0000",
"url":"http://diveintopython.net/http_web_services/redirects.html",
"annotations":[],
"user":"name",
"shared":"yes",
"tags":"python,handler,opener,urllib2",
"readlater":"no",
"created_at":"2011/09/26 22:39:18 +0000",
"title":"11.7.\xc2\xa0Handling redirects",
"comments":[],
"desc":""
},
{
"updated_at":"2011/09/26 11:09:07 +0000",
"url":"http://www.polimex.net/sklep/index.php?page=Category&catid=7",
"annotations":[],
"user":"name",
"shared":"yes",
"tags":"plastic,snap,buttons,clothing",
"readlater":"no",
"created_at":"2011/09/26 11:05:48 +0000",
"title":"Polimex - Plastic\xc2\xa0accessories",
"comments":[],"desc":""
}
]