increment date present list of tuple by weeks python

Mark Lawrence breamoreboy at yahoo.co.uk
Fri May 11 06:14:16 EDT 2012


On 11/05/2012 10:55, Nikhil Verma wrote:
> Hi All
>
>
> I have a list like this :-
>
> [ ('7 May monday AM Neuropancreatic'), ('8 May tuesday PM Cardiovascular')]
>
> how can i increment date in the above list for the next  months on weekly
> basis ?
>
> [ ('7 May monday AM Neuropancreatic'),('14May monday AM
> Neuropancreatic')('21 May monday AM Neuropancreatic')('28 May monday AM
> Neuropancreatic'),
>   ('8 May tuesday PM Cardiovascular'),('15 May monday AM
> Neuropancreatic'),('22 May monday AM Neuropancreatic'),('29 May monday AM
> Neuropancreatic')]
>
>
> Thanks
>

See http://docs.python.org/library/time.html#time.strptime and it's 
cousin strftime, and 
http://docs.python.org/library/datetime.html#module-datetime date and 
timedelta types.

-- 
Cheers.

Mark Lawrence.




More information about the Python-list mailing list