我想从以下网站中提取标题和说明:
view-source:http://www.virginaustralia.com/au/en/bookings/flights/make-a-booking/
使用以下代码片段:
<title>Book a Virgin Australia Flight | Virgin Australia
</title>
<meta name="keywords" content="" />
<meta name="description" content="Search for and book Virgin Australia and partner flights to Australian and international destinations." />
Run Code Online (Sandbox Code Playgroud)
我想要标题和元内容.
我使用鹅但是它没有很好地提取.这是我的代码:
website_title = [g.extract(url).title for url in clean_url_data]
Run Code Online (Sandbox Code Playgroud)
和
website_meta_description=[g.extract(urlw).meta_description for urlw in clean_url_data]
Run Code Online (Sandbox Code Playgroud)
结果是空的
我有以下列表:
sims1 = [[(2, 0.90452874), (1, 0.83522302), (4, 0.77591574), (0, 0.72705799), (3, 0.52282226)],
[(3, 0.79298556), (1, 0.78112978), (2, 0.76006395), (0, 0.58570701), (4, 0.40093967)],
[(2, 0.9549554), (1, 0.71705657), (0, 0.58731651), (3, 0.43987277), (4, 0.38266104)],
[(2, 0.96805269), (4, 0.68034023), (1, 0.66391909), (0, 0.64251828), (3, 0.50730866)],
[(2, 0.84748113), (4, 0.8338449), (1, 0.61795002), (0, 0.60271078), (3, 0.20899911)]]
Run Code Online (Sandbox Code Playgroud)
我想根据这些字符串命名列表中的每个列表:url = ['a', 'b', 'c', 'd']. 例如,
>>> a
[(2, 0.90452874), (1, 0.83522302), (4, 0.77591574), (0, 0.72705799), (3, 0.52282226)]
>>> b
[(3, 0.79298556), (1, 0.78112978), …Run Code Online (Sandbox Code Playgroud)