Re: [Tutor] better way to write this code

2012-08-24 Thread Norman Khine
thank you for the detailed replies, i will try to update the code and post it when done On Fri, Aug 24, 2012 at 1:36 PM, eryksun wrote: > On Fri, Aug 24, 2012 at 8:11 AM, Peter Otten <__pete...@web.de> wrote: > > > > for index, name, fixer in fixers: > > item = event[index] >

Re: [Tutor] better way to write this code

2012-08-24 Thread eryksun
On Fri, Aug 24, 2012 at 8:11 AM, Peter Otten <__pete...@web.de> wrote: > > for index, name, fixer in fixers: > item = event[index] @Norman I forgot to mention this. You should index the event instead of iterating over it. I suppose each event has a name in index 12, so you shou

Re: [Tutor] better way to write this code

2012-08-24 Thread eryksun
On Thu, Aug 23, 2012 at 2:33 PM, Norman Khine wrote: > > import operator, json > from BeautifulSoup import BeautifulSoup If you have the source of TABLE_CONTENT, why don't you soup that instead? Otherwise, nevermind. > combos={0: 'id', > 2: 'country', > 3: 'type', > 5: 'lat', > 6: 'lon', > 12: '

Re: [Tutor] better way to write this code

2012-08-24 Thread Peter Otten
Norman Khine wrote: > I have this code (http://pastie.org/4575790) which pulls data from a list > and then modifies some of the values such as the 'yield' entry, which has > entries like: > > 21 > 15 > ≤ 1000 > ≤ 20 > 2.2 - 30 > > so that they are cleaned up. > can the code be improved furth

Re: [Tutor] better way to write this code

2012-08-24 Thread Norman Khine
ok, thanks On Fri, Aug 24, 2012 at 1:00 AM, Dave Angel wrote: > On 08/23/2012 02:33 PM, Norman Khine wrote: > > Hello, > > I have this code (http://pastie.org/4575790) which pulls data from a > list > > and then modifies some of the values such as the 'yield' entry, which has > > entries like:

Re: [Tutor] better way to write this code

2012-08-23 Thread Dave Angel
On 08/23/2012 02:33 PM, Norman Khine wrote: > Hello, > I have this code (http://pastie.org/4575790) which pulls data from a list > and then modifies some of the values such as the 'yield' entry, which has > entries like: > > 21 > 15 > ≤ 1000 > ≤ 20 > 2.2 - 30 > > so that they are cleaned up. > >

[Tutor] better way to write this code

2012-08-23 Thread Norman Khine
Hello, I have this code (http://pastie.org/4575790) which pulls data from a list and then modifies some of the values such as the 'yield' entry, which has entries like: 21 15 ≤ 1000 ≤ 20 2.2 - 30 so that they are cleaned up. # -*- coding: UTF-8 -*- # Norman Khine import operator, json from B