Skip to content Skip to sidebar Skip to footer

How To Create Page Counter With Shuffled Links

I am wanting to create page count down for shuffled links so easily informed of where my script is actually progressing. I try: def page_counter(): for x in range(1000):

Solution 1:

try this

Replace

links = dict((next(count) + 1, e) for e in elements)
desc_links = sorted(links.items(), key=operator.itemgetter(1))

for link in desc_links:
    driver.get(link[1])
    print(f'At Page: {link[0]}')

With

import collections
links = dict((next(count) + 1, e) for e in elements)

desc_links = collections.OrderedDict(sorted(links.items(), reverse=True))

for key, value in desc_links.items():
    driver.get(value)
    print('At Page: ' + str(key))

Post a Comment for "How To Create Page Counter With Shuffled Links"