Python TextCalendar Module : weekday() method
weekday() method
The weekday() method is used to returns the day of the week (0 is Monday) for year (1970–...), month (1–12), day (1–31).
Syntax:
weekday(year, month, day)
Parameters:
Name | Description | Required / Optional |
Type |
---|---|---|---|
year | Year for which the calendar should be generated. | Required | Number |
month | month for which the calendar should be generated. | Required | Number |
day | day for which the calendar should be generated. | Required | Number |
Example of weekday() method
import calendar
print(calendar.weekday(2016, 5, 15))
Output:
6
Previous: leapdays()
Next: weekheader()
Test your Python skills with w3resource's quiz
Python: Tips of the Day
How to make a chain of function decorators?
from functools import wraps def makebold(fn): @wraps(fn) def wrapped(*args, **kwargs): return "<b>" + fn(*args, **kwargs) + "</b>" return wrapped def makeitalic(fn): @wraps(fn) def wrapped(*args, **kwargs): return "<i>" + fn(*args, **kwargs) + "</i>" return wrapped @makebold @makeitalic def hello(): return "hello world" @makebold @makeitalic def log(s): return s print hello() # returns "<b><i>hello world</i></b>" print hello.__name__ # with functools.wraps() this returns "hello" print log('hello') # returns "<b><i>hello</i></b>"
Ref: https://bit.ly/3cVz5iw
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework