I need to schedule the function automatically by the selected days. So I used schedule for this function but I can't pass arguments to the schedule object dynamically. If anyone knows how to achieve that, please provide me the solution. Below is my code:
import schedule
def job(ip_id):
print "Schedule started" + ip_id
ip_id = 1
sname = "weekly"
sched = schedule.every().monday.do(job, ip_id).tag(sname)
It works and scheduled on monday but when I pass the value from list, error arise.
import schedule
def job(ip_id):
print "Schedule started" + ip_id
ip_id = 1
sname = "weekly"
cron = [monday, wednesday, sunday]
for i in cron:
sched = schedule.every().i.do(job, ip_id).tag(sname)
How to pass value to that place is my problem ?