Q:

How to get a list of dates from a week number in python

So I know the week number of a date using x = mydate.strftime("%U") now I need to find all the dates that fall in that week. Ultimately I need to get a query set from django on date object that returns all records that are in a given week based only on knowing the week number. Something like:
y = Stuff.objects.filter=(date__range=[#anydate that is in the week number of x])

A:

You can use Arrow for that:
import arrow

def get_week(dt):
    mydate = arrow.get(dt)
    start = mydate.floor('week')
    end = mydate.ceil('week')
    return arrow.Arrow.range('day', start, end)

Output:
In [369]: list(get_week(datetime.datetime.utcnow()))
Out[369]: 
[<Arrow [2015-04-20T00:00:00+00:00]>,
 <Arrow [2015-04-21T00:00:00+00:00]>,
 <Arrow [2015-04-22T00:00:00+00:00]>,
 <Arrow [2015-04-23T00:00:00+00:00]>,
 <Arrow [2015-04-24T00:00:00+00:00]>,
 <Arrow [2015-04-25T00:00:00+00:00]>,
 <Arrow [2015-04-26T00:00:00+00:00]>]

