datetime
` module, retrieves the current date and time, and returns the year and name of the weekday:import datetime
# Get the current date and time
now = datetime.datetime.now()
# Extract the year from the current date
year = now.year
# Get the name of the weekday
weekday = now.strftime("%A")
# Print the year and weekday name
print("Year: ", year)
print("Weekday: ", weekday)
Year: 2023
Weekday: Thursday
strftime()
` method is used to format the date and time in the desired string format. %A
` directive is used to retrieve the full name of the weekday.