for page in range(1, 67):
url_list = 'http://top.chinaz.com/hangye/index_news_{}.html'.format(page) #获取列表页链接
# url_list1 = url_list.split()
print(type(url_list))
print(url_list)
输出结果:
<class 'str'>
http://top.chinaz.com/hangye/index_news_1.html
<class 'str'>
http://top.chinaz.com/hangye/index_news_2.html
<class 'str'>
http://top.chinaz.com/hangye/index_news_3.html
<class 'str'>
http://top.chinaz.com/hangye/index_news_4.html
...
<class 'str'>
http://top.chinaz.com/hangye/index_news_67.html
我把获取到的链接,都赋给了url_list。
打印一下url_list的内容和类型。
请问,怎么从url_list里把每一个链接单独取出来?因为我后面需要把每个链接都单独打开。
听不懂你在说什么.
保存到数组就行了.