Re: [Tutor] date formatter

2008-08-08 Thread Kent Johnson
On Fri, Aug 8, 2008 at 1:34 AM, Christopher Spears <[EMAIL PROTECTED]> wrote: > Ok, here is the working version of my program. Thanks for all of the advice: > > #!/usr/bin/python > > import time > > class date_format(object): This is a bit of a misnomer, you aren't formatting the date, you are p

Re: [Tutor] date formatter

2008-08-07 Thread Christopher Spears
ot;__main__": print "Welcome to the Date Formatter!" month = raw_input("Please enter a month (as a number): ") day = raw_input("Please enter a day: ") year = raw_input("Please enter a year: ") da

Re: [Tutor] date formatter

2008-08-07 Thread Benoit Thiell
On Thu, 7 Aug 2008, bob gailer wrote: Christopher Spears wrote: Hey, I'm working on a problem out of Core Python Programming (2nd Edition). Basically, I'm creating a class that formats dates. Here is what I have so far: Consider reformatting the month_dict so each name and abbreviatio

Re: [Tutor] date formatter

2008-08-07 Thread bob gailer
Christopher Spears wrote: Hey, I'm working on a problem out of Core Python Programming (2nd Edition). Basically, I'm creating a class that formats dates. Here is what I have so far: Consider reformatting the month_dict so each name and abbreviation is a key. Then you can just look up th

Re: [Tutor] date formatter

2008-08-06 Thread wesley chun
>try: >month = int(month) >except ValueError: >for eachKey in month_dict.keys(): >if month.lower() in eachKey: >month = month_dict[eachKey] >

Re: [Tutor] date formatter

2008-08-06 Thread Timothy Grant
On Wed, Aug 6, 2008 at 11:01 PM, Christopher Spears <[EMAIL PROTECTED]> wrote: > Hey, > > I'm working on a problem out of Core Python Programming (2nd Edition). > Basically, I'm creating a class that formats dates. Here is what I have so > far: > > #!/usr/bin/python > > import time > > class da

[Tutor] date formatter

2008-08-06 Thread Christopher Spears
Hey, I'm working on a problem out of Core Python Programming (2nd Edition). Basically, I'm creating a class that formats dates. Here is what I have so far: #!/usr/bin/python import time class date_format(object): def __init__(self, month, day, year): month_dict = {("j