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] Merging dictionaries

2008-08-06 Thread Benoit Thiell
Dear Norman, I would propose: ret = {} myvalues = [] responses = [{'a1': [1], 'a2': [1, 2, 3]}, {'a1': [0], 'a2': [0, 1, 3]}] for response in responses: for answer in response.items() ret.setdefault(response[0], []).app

Re: [Tutor] removing whole numbers from text

2008-08-02 Thread Benoit Thiell
Dear Dinesh, if you're using the regular expression only once, I would recommend: without_numbers = " ".join(re.split(" [0-9]+ ", phrase)) If not, compile the regular expression first and use the compiled version. Regards, Benoit Thiell. On Sat, 2 Aug 2008, Noufal Ib

Re: [Tutor] how do I create a lists of values associated with a key?

2008-08-01 Thread Benoit Thiell
Regards, Benoit Thiell. On Fri, 1 Aug 2008, Marc Tompkins wrote: On Thu, Jul 31, 2008 at 8:16 PM, Angela Yang <[EMAIL PROTECTED]> wrote: Hi, I have a list of values for one key.  How do I specify this data structure? First tried, collection = []