1

list = [40000 elements]

After processing first 30 elements need to pause for 5 minutes and then start processing again the next 30 element from the list.

a = list(set(proflinks))
a = sorted(a) # list a has 40000 elements
a=a[0:30]
#print(a)
for b in a:
    inedex = a.index(b)
    print('profile____' + str(inedex) + '____is processing')
    profileMeta(driver,b)
Shrikanth N
  • 652
  • 3
  • 17
Jhon Doe
  • 113
  • 1
  • 11
  • Possible duplicate of [How can I make a time delay in Python?](https://stackoverflow.com/questions/510348/how-can-i-make-a-time-delay-in-python) – ScottMcC Feb 13 '19 at 05:59
  • @ScottMcC, this dupe suggestion is pretty weak... – Stephen Rauch Feb 13 '19 at 06:00
  • profileMeta will process first 30 elements. after that it will rest for 5 minutes and continue processing another 30 elements. this process will be continued until the list is empty. – Jhon Doe Feb 13 '19 at 06:02
  • You can set the `delay` parameter in the `custom_setting` before parsing the url. – Pankaj Feb 13 '19 at 06:03
  • @StephenRauch I disagree. The solution to this problem isn't any more complicated than inserting a `time.sleep()` command at the correct point. – ScottMcC Feb 13 '19 at 06:30
  • @ScottMcC, yes but... The duplicate indicates how to sleep. So what? It does not indicate how to sleep at the appropriate point. – Stephen Rauch Feb 13 '19 at 06:33

1 Answers1

1

Use enumerate() and % to decide when to sleep like:

import time 
a = sorted(set(proflinks)) # list a has 40000 elements
for idx, b in enumerate(a):
    print('profile____{}____is processing'.format(idx)
    profileMeta(driver, b)
    if not ((idx + 1) % 30):
        time.sleep(600)
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135