dbader / schedule

Python job scheduling for humans.
https://schedule.readthedocs.io/
MIT License
11.73k stars 959 forks source link

Updated README Usage to work with function argument #519

Closed rudSarkar closed 2 years ago

rudSarkar commented 2 years ago

This PR is about a few changes on the README file, where I added demo usages because people mostly find and wanted to work with function arguments instantly. I created this PR because there are more lazy people like me who will find it useful.

Another example given below is to work with multiple arguments.

import schedule
import time

def job():
    print("I'm working...")

""" working with multiple argument """
def function_job(name, age):
    print(f"I am {name} and my age is: {age}")

schedule.every(10).seconds.do(job)
schedule.every(10).seconds.do(function_job, name="Peter Griffin", age=22)

while True:
    schedule.run_pending()
    time.sleep(1)

Thanks, @rudSarkar

coveralls commented 2 years ago

Coverage Status

Coverage remained the same at 99.699% when pulling da68c3fc948ca946e9779d080c4290a7b795562d on rudSarkar:patch-1 into ed7d21961242f86342da240ee1d089c1cee37de6 on dbader:master.