Graham, Would it help to use another web site? Not as long as the program works on this site. If it doesn't it may help to change sites, but a new reader would have to be crafted. Towards this my code may look intimidating. It isn't really a good example for a demo, because it looks scary. As I said, I experimentally stretched the envelope. The trick is to develop incrementally, one step at a time, look at the result of each stage, recognize what needs to be done next and add missing definitions or add a subsequent translation step. In this manner a complex system can be built. SE is particualry accommodating in this respect. You can test an Editor object in seconds on the IDLE command line, e.g.:
>>> s = 'Total: $1,234.55 (-6.7)' >>> print SE.SE ('"$=USD " ,=\' .=, ":= " )=%)') (s) Total USD 1'234,55 (-6,7%) It also helps to read SE-DOC.HTM which explains a host of basic techniques. Glad to help Frederic ----- Original Message ----- From: "Graham Feeley" <[EMAIL PROTECTED]> Newsgroups: comp.lang.python To: <python-list@python.org> Sent: Sunday, July 30, 2006 5:55 AM Subject: Re: Newbie..Needs Help > Well Well Well, Anthra you are a clever person, Are > nt you!!!! > I nearly fell over when i read your post. > Would it help if we used another web site to gather data???? > As you stated the tables are not all that well structured. > well I will give thisone a go first and if there is anything I can do for > you just ask and I will try my best. > I really appreciate what you have done. > Of course I will try to follow your code to see if any will fall on > me....LOL > Regards > Graham > > "Anthra Norell" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > > ----- Original Message ----- > > From: "Graham Feeley" <[EMAIL PROTECTED]> > > Newsgroups: comp.lang.python > > To: <python-list@python.org> > > Sent: Friday, July 28, 2006 5:11 PM > > Subject: Re: Newbie..Needs Help > > > > > >> Thanks Nick for the reply > >> Of course my first post was a general posting to see if someone would be > >> able to help > >> here is the website which holds the data I require > >> http://www.aapracingandsports.com.au/racing/raceresultsonly.asp?storydate=27/07/2006&meetings=bdgo > >> > >> The fields required are as follows > >> NSW Tab > >> # Win Place > >> 2 $4.60 $2.40 > >> 5 $2.70 > >> 1 $1.30 > >> Quin $23.00 > >> Tri $120.70 > >> Field names are > >> Date ( not important ) > >> Track................= Bendigo > >> RaceNo............on web page > >> Res1st...............2 > >> Res2nd..............5 > >> Res3rd..............1 > >> Div1..................$4.60 > >> DivPlc...............$2.40 > >> Div2..................$2.70 > >> Div3..................$1.30 > >> DivQuin.............$23.00 > >> DivTrif...............$120.70 > >> As you can see there are a total of 6 meetings involved and I would need > >> to > >> put in this parameter ( =bdgo) or (=gosf) these are the meeting tracks > >> > >> Hope this more enlightening > >> Regards > >> graham > >> > > > > Graham, > > > > Only a few days ago I gave someone a push who had a very similar problem. > > I handed him code ready to run. I am doing it again for > > you. > > The site you use is much harder to interpret than the other one was > > and so I took the opportunity to experimentally stretch > > the envelope of a new brain child of mine: a stream editor called SE. It > > is new and so I also take the opportunity to demo it. > > One correspondent in the previous exchange was Paul McGuire, the > > author of 'pyparse'. He made a good case for using 'pyparse' > > in situations like yours. Unlike a stream editor, a parser reads structure > > in addition to data and can relate the data to its > > context. > > Anlayzing the tables I noticed that they are poorly structured: The > > first column contains both data and ids. Some records are > > shorter than others, so column ids have to be guessed and hard coded. > > Missing data sometimes is a dash, sometimes nothing. The > > inconsistencies seem to be consistent, though, down the eight tables of > > the page. So they can be formalized with some confidence > > that they are systematic. If Paul could spend some time on this, I'd be > > much interested to see how he would handle the relative > > disorder. > > Another thought: The time one invests in developing a program should > > not exceed the time it can save overall (not talking > > about recreational programming). Web pages justify an extra measure of > > caution, because they may change any time and when they do > > they impose an unscheduled priority every time the reader stops working > > and requires a revision. > > > > So, here is your program. I write it so you can copy the whole thing to a > > file. Next copy SE from the Cheese Shop. Unzip it and put > > both SE.PY and SEL.PY where your Python progams are. Then 'execfile' the > > code in an IDLE window, call 'display_horse_race_data > > ('Bendigo', '27/07/2006') and see what happens. You'll have to wait ten > > seconds or so. > > > > Regards > > > > Frederic > > > > ###################################################################################### > > ..... etc. -- http://mail.python.org/mailman/listinfo/python-list