Pattern matching from a text document

Ben benji_tranter at hotmail.com
Thu Mar 24 09:16:12 EST 2005


George Sakkis wrote:
> B
> "Ben" <benji_tranter at hotmail.com> wrote in message
> news:1111596005.241773.136870 at z14g2000cwz.googlegroups.com...
> > I'm currently trying to develop a demonstrator in python for an
> > ontology of a football team. At present all the fit players are
> > exported to a text document.
> >
> > The program reads the document in and splits each line into a
string
> > (since each fit player and their attributes is entered line by line
in
> > the text document) using list = target.splitlines()
> >
> > [snipped]
> >
> > The program then performs a loop like so:
> >
> > The two main problems I'm having are that the first and entry in
the
> > list is not printing. Once I have overcome this problem I then need
> > each player and there related variables to be stored seperately.
This
> > is not happening at present because each time the loop runs it
> > overwrites the value in each variable.
> >
> > Any help would be greatly appreciated.
> >
> > Ben.
>
>
> Ben, can you post a sample line from the document and indicate the
fields you want to extract? I'm
> sure it will be easier to help you this way.
>
> George
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> "If a slave say to his master: "You are not my master," if they
convict
> him his master shall cut off his ear."
>
> Hammurabi's Code of Laws
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Below is a few sample lines. There is the name followed by the class
(not important) followed by 5 digits each of which can range 1-9 and
each detail a different ability, such as fitness, attacking ability
etc. Finally the preferred foot is stated.

Freddie Ljungberg	Player	02808right
Dennis Bergkamp	Player	90705either
Thierry Henry	Player	90906either
Ashley Cole	Player	17705left


Thanks for your help

ben




More information about the Python-list mailing list