例某网站的URL集是这样的
https://www.555zw.com/book/40/40934/10334793.html
https://www.555zw.com/book/40/40934/10334794.html
https://www.555zw.com/book/40/40934/10334795.html
https://www.555zw.com/book/40/40934/10334796.html
https://www.555zw.com/book/40/40934/10334797.html
...
通过列表推导式,构造URL列表
#[构造 赋值]
#使用
urls=[‘https://www.555zw.com/book/40/40934/1033479{}.html‘.format(number)] for number in range (3,8)]
for url in urls:
print(url)
原文地址:https://www.cnblogs.com/lanbofei/p/8669802.html
时间: 2024-11-05 18:50:23