我的scrapy代码中得到以下回复:
[ [ “1-2809328194” “SHREE RAYESHWAR工程与信息技术学院”, “SHIV SHAIL,KARAI,SHIRODA,GOA 403103”, “北方之乡”, “独立 - 私人”, “N”, “N”, “1-13315171” ] [ “1-2809364960” “阿尼尔技术与设计学院”, “ASSAGAO,\ r \ nBARDEZ,\ r \ NGOA。” “北方之乡”, “独立 - 私人”, “N”, “N”, “1-792836711” ] [ “1-2809439609” “GOA COLLEGE of PHARMACY”, “6月18日,PANAJI-GOA”, “北方之乡”, “政府”, “N”, “N”, “1-12606241” ] [ “1-2809451721” “GOA艺术学院”, “ALTINHO,\ r \ nPANAJI - GOA \ r \ n \ n403 001”, “北方之乡”, “政府”, “N”, “N”, “1-34323441” ] [ “1-2809452173” “PADRE CONCEICAO COLLEGE OF ENGINEERING”, “AGNEL GANV,VERNA,GOA - 403722”, “南方之乡”, “独立 - 私人”, “N”, “N”, “1-39482811” ] [ “1-2809476211” “政府多功能火炬手”, “OPP。KAKODA INDUSTRIAL ESTATE”, “南方之乡”, “政府”, “N”, “N”, “1-453010201” ] [ “1-2809500050” “AGNEL食品工艺和烹饪科学研究所”, “AGNEL TECHNICAL EDUCATION COMPLEX \ r \ nAGNEL ASHRAM \ r \ nVERNA”, “南方之乡”, “独立 - 私人”, “N”, “N”, “1-473844331” ] [ “1-2809505343” “PONDA教育协会RAJARAM和TARABAI BANDEKAR药房学院”, “PONDA-PANAJI ROAD,FARMAGUDI,PONDA.GEA-403401”, “南方之乡”, “独立 - 私人”, “N”, “N”, “1-9749331” ] [ “1-2809601268” “政府POLYTECHNIC MAYEM BICHOLIM”, “MAYEM BICHOLIM GOA”, “北方之乡”, “政府”, “N”, “N”, “1-455631951” ] ]
如何提取它?
答案 0 :(得分:2)
您的输出是嵌套列表,每个列表对应单个记录,您可以尝试以下方法:
lets say:
records = [['1-2809328194', 'SHREE RAYESHWAR INSTITUTE OF ENGINEERING AND INFORMATION TECHNOLOY', 'SHIV SHAIL, KARAI, SHIRODA, GOA 403103', 'NORTH GOA', 'Unaided - Private', 'N', 'N', '1-13315171'], ['1-2809364960', 'AGNEL INSTITUTE OF TECHNOLOGY AND DESIGN', 'ASSAGAO,\r\nBARDEZ,\r\nGOA.', 'NORTH GOA', 'Unaided - Private', 'N', 'N', '1-792836711']]
for item in records:
yield {
field1: item[0],
field2: item[1]
.....
.....
}