The zip function allows you to bind the collection as shown below.
Note that each collection must have the same number. Otherwise, it will be cut off except for the pair being matched.
In [1]: for a, b in zip(range(10), range(10)):
...: ...: print(a, b)
...:
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
Try it as below.
for a, b in zip(soup.select('font > stong'), soup.select('lmis')):
print(a, b)
© 2024 OneMinuteCode. All rights reserved.