- Saved searches
- Use saved searches to filter your results more quickly
- License
- dbader/schedule
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.rst
- schedule¶
- Example ¶
- When not to use Schedule¶
- Read More¶
- Issues¶
- About Schedule¶
- Программа учета рабочего времени на питоне
- 1 ответ
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Python job scheduling for humans.
License
dbader/schedule
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.rst
Python job scheduling for humans. Run Python functions (or any other callable) periodically using a friendly syntax.
- A simple to use API for scheduling jobs, made for humans.
- In-process scheduler for periodic jobs. No extra processes needed!
- Very lightweight and no external dependencies.
- Excellent test coverage.
- Tested on Python and 3.7, 3.8, 3.9, 3.10, 3.11
import schedule import time def job(): print("I'm working. ") schedule.every(10).seconds.do(job) schedule.every(10).minutes.do(job) schedule.every().hour.do(job) schedule.every().day.at("10:30").do(job) schedule.every(5).to(10).minutes.do(job) schedule.every().monday.do(job) schedule.every().wednesday.at("13:15").do(job) schedule.every().day.at("12:42", "Europe/Amsterdam").do(job) schedule.every().minute.at(":17").do(job) def job_with_argument(name): print(f"I am name>") schedule.every(10).seconds.do(job_with_argument, name="Peter") while True: schedule.run_pending() time.sleep(1)
Schedule’s documentation lives at schedule.readthedocs.io.
Inspired by Adam Wiggins’ article «Rethinking Cron» and the clockwork Ruby module.
Distributed under the MIT license. See LICENSE.txt for more information.
schedule¶
Python job scheduling for humans. Run Python functions (or any other callable) periodically using a friendly syntax.
- A simple to use API for scheduling jobs, made for humans.
- In-process scheduler for periodic jobs. No extra processes needed!
- Very lightweight and no external dependencies.
- Excellent test coverage.
- Tested on Python 3.7, 3.8, 3.9, 3.10 and 3.11
Example ¶
import schedule import time def job(): print("I'm working. ") schedule.every(10).minutes.do(job) schedule.every().hour.do(job) schedule.every().day.at("10:30").do(job) schedule.every().monday.do(job) schedule.every().wednesday.at("13:15").do(job) schedule.every().day.at("12:42", "Europe/Amsterdam").do(job) schedule.every().minute.at(":17").do(job) while True: schedule.run_pending() time.sleep(1)
When not to use Schedule¶
Let’s be honest, Schedule is not a ‘one size fits all’ scheduling library. This library is designed to be a simple solution for simple scheduling problems. You should probably look somewhere else if you need:
- Job persistence (remember schedule between restarts)
- Exact timing (sub-second precision execution)
- Concurrent execution (multiple threads)
- Localization (workdays or holidays)
Schedule does not account for the time it takes for the job function to execute. To guarantee a stable execution schedule you need to move long-running jobs off the main-thread (where the scheduler runs). See Parallel execution for a sample implementation.
Read More¶
- Installation
- Python version support
- Dependencies
- Installation instructions
- Run a job every x minute
- Use a decorator to schedule a job
- Pass arguments to a job
- Cancel a job
- Run a job once
- Get all jobs
- Cancel all jobs
- Get several jobs, filtered by tags
- Cancel several jobs, filtered by tags
- Run a job at random intervals
- Run a job until a certain time
- Time until the next execution
- Run all jobs now, regardless of their scheduling
- Timezone in .at()
- Daylight Saving Time
- Example
- Customize logging
- AttributeError: ‘module’ object has no attribute ‘every’
- ModuleNotFoundError: No module named ‘schedule’
- ModuleNotFoundError: ModuleNotFoundError: No module named ‘pytz’
- Does schedule support time zones?
- What if my task throws an exception?
- How can I run a job only once?
- How can I cancel several jobs at once?
- How to execute jobs in parallel?
- How to continuously run the scheduler without blocking the main thread?
- Another question?
- Main Interface
- Classes
- Exceptions
- Preparing for development
- Running tests
- Formatting the code
- Compiling documentation
- Publish a new version
Issues¶
If you encounter any problems, please file an issue along with a detailed description. Please also use the search feature in the issue tracker beforehand to avoid creating duplicates. Thank you 😃
About Schedule¶
Inspired by Adam Wiggins’ article “Rethinking Cron” and the clockwork Ruby module.
Distributed under the MIT license. See LICENSE.txt for more information.
Thanks to all the wonderful folks who have contributed to schedule over the years:
- mattss
- mrhwick
- cfrco
- matrixise
- abultman
- mplewis
- WoLfulus
- dylwhich
- fkromer
- alaingilbert
- Zerrossetto
- yetingsky
- schnepp
- grampajoe
- gilbsgilbs
- Nathan Wailes
- Connor Skees
- qmorek
- aisk
- MichaelCorleoneLi
- sijmenhuizenga
- eladbi
- chankeypathak
- vubon
- gaguirregabiria
- rhagenaars
- Skenvy
- zcking
- Martin Thoma
- ebllg
- fredthomsen
- biggerfisch
- sosolidkk
- rudSarkar
- chrimaho
- jweijers
- Akuli
- NaelsonDouglas
- SergBobrovsky
- CPickens42
- emollier
- sunpro108
Программа учета рабочего времени на питоне
Создайте программу «табель рабочего времени», которая считывает файлы журнала, созданные вашей программой часов из проекта 4, и добавляет отработанные часы в файл базы данных заработной платы. Ваша программа должна использовать идентификаторы пользователей в качестве первичного ключа для базы данных (первый элемент данных в каждой строке), а затем перечислять дату и продолжительность каждой смены, в которой работает сотрудник (по одной смене на строку).
У меня отлично работают часы, я просто не знаю, как заставить Python оценивать время. Это вывод программы часов в файл.
ClockIN EmpleyeeNumber: 1234566 ClockTime: 08:54:44 ClockDate: 12/07/2016 ClockOUT EmpleyeeNumber: 1234566 ClockTime: 08:55:20 ClockDate: 12/07/2016 ClockIN EmpleyeeNumber: 1234567 ClockTime: 09:14:50 ClockDate: 12/07/2016 ClockOUT EmpleyeeNumber: 1234567 ClockTime: 09:15:02 ClockDate: 12/07/2016
1 ответ
from datetime import datetime filename = 'input.txt' with open(filename, 'r') as file: with open('timeSheet.txt', 'a') as f: lines = file.readlines() datas = [] for line in lines: class_in_out, _, id, _, time, _, date = line.strip().split(" ") exist = False for data in datas: if data['id'] == id: exists_date = False for date_ in data['date']: if date in date_: date_[date][class_in_out] = time exists_date = True break if not exists_date: data['date'].append(>) exist = True break if not exist: data = <'id': id, 'date': [>]> datas.append(data) outputs = [] for data in datas: output = values = data['date'] for value in values: for key in value: start = valuePython учет рабочего времени['ClockIN'] stop = valuePython учет рабочего времени['ClockOUT'] date_start = datetime.strptime(start, '%H:%M:%S') date_stop = datetime.strptime(stop, '%H:%M:%S') delta = date_stop - date_start output['date'].append() outputs.append(output) for output in outputs: print(output) f.write('\n") f.close()
ClockIN EmpleyeeNumber: 1234566 ClockTime: 08:54:44 ClockDate: 12/07/2016 ClockOUT EmpleyeeNumber: 1234566 ClockTime: 08:55:20 ClockDate: 12/07/2016 ClockIN EmpleyeeNumber: 1234567 ClockTime: 09:14:50 ClockDate: 12/07/2016 ClockOUT EmpleyeeNumber: 1234567 ClockTime: 09:15:02 ClockDate: 12/07/2016 ClockIN EmpleyeeNumber: 1234566 ClockTime: 08:54:42 ClockDate: 13/07/2016 ClockOUT EmpleyeeNumber: 1234566 ClockTime: 08:55:02 ClockDate: 13/07/2016 ClockIN EmpleyeeNumber: 1234567 ClockTime: 09:14:51 ClockDate: 13/07/2016 ClockOUT EmpleyeeNumber: 1234567 ClockTime: 09:15:06 ClockDate: 13/07/2016