Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.076 X-Spam-Evidence: '*H*': 0.85; '*S*': 0.00; 'f.close()': 0.09; 'subject:How': 0.10; '2.7': 0.14; 'bonus.': 0.16; 'increment': 0.16; 'received:65.55.116.7': 0.16; 'index': 0.16; 'numerical': 0.19; 'subject:week': 0.19; 'import': 0.22; 'to:name:python- list@python.org': 0.22; 'received:65.55.116': 0.24; 'skip:% 10': 0.24; 'file.': 0.24; '>': 0.26; 'header:In-Reply-To:1': 0.27; 'front': 0.32; 'date:': 0.34; 'skip:d 20': 0.34; 'could': 0.34; 'skip:f 40': 0.36; 'subject:?': 0.36; 'email addr:python.org': 0.37; 'starting': 0.37; 'to:addr:python-list': 0.38; 'list,': 0.38; 'subject:': 0.39; 'moving': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'save': 0.62; 'email addr:gmail.com': 0.63; 'skip:6 10': 0.63; 'today': 0.64; 'email name:python-list': 0.65; 'date,': 0.68; 'day': 0.76; '2013': 0.98 X-TMN: [udtrYmiRU9ULEsv0nlIDTAmFa7jtdmwm] X-Originating-Email: [carlosnepomuceno@outlook.com] Content-Type: multipart/alternative; boundary="_0b9db2bb-b75f-404f-933d-a874894c9294_" From: Carlos Nepomuceno To: "python-list@python.org" Subject: RE: How to increment date by week? Date: Wed, 5 Jun 2013 01:52:01 +0300 Importance: Normal In-Reply-To: References: MIME-Version: 1.0 X-OriginalArrivalTime: 04 Jun 2013 22:52:02.0094 (UTC) FILETIME=[20942CE0:01CE6176] X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 68 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1370386330 news.xs4all.nl 15943 [2001:888:2000:d::a6]:33882 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:46980 --_0b9db2bb-b75f-404f-933d-a874894c9294_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > Date: Tue=2C 4 Jun 2013 14:31:07 -0700 > Subject: How to increment date by week? > From: r90230@gmail.com > To: python-list@python.org >=20 > Starting on any day/date=2C I would like to create a one year list=2C = by week (start date could be any day of week). Having a numerical week ind= ex in front of date=2C ie 1-52=2C would be a bonus. =20 > ie=2C 1. 6/4/2013 > 2. 6/11/2013 > 3. 6/18/2013....etc to # 52. >=20 > And to save that result to a file. > Moving from 2.7 to 3.3 > TIA YAS: import datetime today =3D datetime.datetime.today() week =3D datetime.timedelta(weeks=3D1) f=3Dopen('output.txt'=2C'w') for i in range(52): f.write((today+i*week).strftime(str(i+1)+'. %Y-%m-%d\n')) f.close() = --_0b9db2bb-b75f-404f-933d-a874894c9294_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
>=3B Date: Tue=2C 4 Jun 2013 1= 4:31:07 -0700
>=3B Subject: How to increment date by week?
>= =3B From: r90230@gmail.com
>=3B To: python-list@python.org
>=3B <= br>>=3B Starting on any day/date=2C I would like to create a one year = list=2C by week (start date could be any day of week). Having a numerical = week index in front of date=2C ie 1-52=2C would be a bonus.
>=3B = ie=2C 1. 6/4/2013
>=3B 2. 6/11/2013
>=3B 3. 6/18= /2013....etc to # 52.
>=3B
>=3B And to save that result to a = file.
>=3B Moving from 2.7 to 3.3
>=3B TIA

YAS:

= import datetime
today =3D datetime.datetime.today()
week =3B =3D = datetime.timedelta(weeks=3D1)

f=3Dopen('output.txt'=2C'w')
for i = in range(52):
 =3B =3B =3B f.write((today+i*week).strftime(s= tr(i+1)+'. %Y-%m-%d\n'))
f.close()

= --_0b9db2bb-b75f-404f-933d-a874894c9294_--