Python ProgrammingPython Programming

How to get start and end date of Week from specific date in Python?

Use Pendulum module to solve Date time problems.
Install it using below command

pip install pendulum
import pendulum

dt = pendulum.datetime(2012, 9, 5)

start = dt.start_of('week')
print(start.to_datetime_string())

end = dt.end_of('week')
print(end.to_datetime_string())
Output
2012-09-03 00:00:00
2012-09-09 23:59:59