A simple Python Weekends lib
Project description
PyWeekends: Weekend Dates Formatter
PyWeekends is a Python package that provides a convenient way to generate weekend dates based on the Calendar.
It includes a class named Weekend
to generate weekend dates and an OutputFormatter
class to format
the generated dates into JSON.
Features
- Generate weekend dates for all months in a given year.
- Generate weekend dates for a specific month.
- Format the generated dates as JSON.
Installation
To install the package, use pip:
pip install PyWeekends
Usage
from PyWeekends import Weekend, WeekendStart
# Generate weekend dates for a specific month and format as JSON
w = Weekend(year=2024)
january_weekends = w.month_weekends("January")
json_data = january_weekends.as_json()
print(json_data)
# Output
# ["6", "7", "13", "14", "20", "21", "27", "28"]
# Generate weekend dates for all months and format as JSON
all_month_weekends = w.all_weekends()
json_data_all_months = all_month_weekends.as_json()
print(json_data_all_months)
#Output
# {"1": ["6", "7", "13", "14", "20", "21", "27", "28"], "2": ["3", "4", "10", "11", "17", "18", "24", "25"],
# "3": ["2", "3", "9", "10", "16", "17", "23", "24", "30", "31"], "4": ["6", "7", "13", "14", "20", "21", "27", "28"],
# "5": ["4", "5", "11", "12", "18", "19", "25", "26"], "6": ["1", "2", "8", "9", "15", "16", "22", "23", "29", "30"],
# "7": ["6", "7", "13", "14", "20", "21", "27", "28"], "8": ["3", "4", "10", "11", "17", "18", "24", "25", "31"],
# "9": ["1", "7", "8", "14", "15", "21", "22", "28", "29"], "10": ["5", "6", "12", "13", "19", "20", "26", "27"],
# "11": ["2", "3", "9", "10", "16", "17", "23", "24", "30"], "12": ["1", "7", "8", "14", "15", "21", "22", "28", "29"]}
Changelog
See Changelog
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
PyWeekends-0.0.1.tar.gz
(4.8 kB
view details)
Built Distribution
File details
Details for the file PyWeekends-0.0.1.tar.gz
.
File metadata
- Download URL: PyWeekends-0.0.1.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a6d679c226d7b15af6bd0070e1ac039d33913ebd5e0986a742fc3faf786aba5 |
|
MD5 | 0c22b2ba0b347f8468b300524b3c450a |
|
BLAKE2b-256 | c94d59c6e1d06d93a0409694f15ebd62b908cef7214dff1aed228a35cbdc79af |
File details
Details for the file PyWeekends-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: PyWeekends-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | afc4621f55d5bb0beb8d4a06ee05cefb939efbe6c42e89fe6cb22a38a7bc0033 |
|
MD5 | 0223342b7dd08372d97f05d3c9bac6d6 |
|
BLAKE2b-256 | f6e075492b70473f4337820a99c145c32eb14535fa7b098be629c17f8cdc8335 |