On 8 feb, 12:41, "Shawn Milo" <[EMAIL PROTECTED]> wrote:

> I have come up with something that's working fine. However, I'm fairly
> new to Python, so I'd really appreciate any suggestions on how this
> can be made more Pythonic.

A few comments:

You don't need the formatDatePart function; delete it, and replace
newDate = ",%s-%s-%s," % (yearNum,monthNum,dayNum)
with
newDate = ",%04.4d-%02.2d-%02.2d," % (yearNum,monthNum,dayNum)

and before:
                dayNum, monthNum, yearNum = [int(num) for num in
someDate[1:-1].split('/')]

And this: outfile.writelines(line)
should be: outfile.write(line)
(writelines works almost by accident here).

You forget again to use () to call the close methods:
infile.close()
outfile.close()

I don't like the final replace, but for a script like this I think
it's OK.

--
Gabriel Genellina

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to