Here is a test sample of what I have: This currently correctly
identifies the start and the end of the changelog entries and I can
identify the requested item records. What I am struggling with at
present is to how to create records of the full changelog entries for
each of the found items.

Again any help greatly appreciated.


uid = "000028.txt"


file = open("C:\projects\SuiteSpecification\Notes\ChangeLog.txt")

output = file.readlines()
changeLogList = []
itemList = []
for strOut in output:

    if "----" in strOut:
        changeLogStart = 1
    itemList.append(strOut)       
    if "Reviewed:" in strOut:
        changeLogStart=0
for item in itemList:
    if uid in item:
        print item


Dean Gardner
Test Engineer 
Barco
Bonnington Bond, 2 Anderson Place, Edinburgh EH6 5NP, UK
Tel + 44 (0) 131 472 5731 Fax + 44 (0) 131 472 4799
www.barco.com 
[EMAIL PROTECTED] 


-----Original Message-----
From: Kent Johnson [mailto:[EMAIL PROTECTED] 
Sent: 03 May 2007 13:46
To: Gardner, Dean
Cc: [email protected]
Subject: Re: [Tutor] Text matching

Gardner, Dean wrote:
> Hi Folks
> 
> I wish to isolate certain changelog entries and display them to the 
> user, for example:
> 
> Changelog.txt
> 
> ----------Some Module <Tag> ---------- M 000751 - Title
>>  what was amended
> Reviewed by: Someone
> 
> For this text file I wish to find all entries for 000751 and then 
> present each of the changelog entries.
> 
> My thought was to
> identify the "----" with a regular expression identifying this as the 
> changelog start

You probably don't need a regex here, something like
   if line.startswith('----------'):
will probably work

> attempt to find the item number

   if line.split()[1] == '000751':

> if it isn't found move on, if it is found then add this to a list.
> 
> But I feel as though there must be a simpler and more effecient way.

This sounds good to me except for the regex. Can you show us your code?

Kent



DISCLAIMER:
Unless indicated otherwise, the information contained in this message is 
privileged and confidential, and is intended only for the use of the 
addressee(s) named above and others who have been specifically authorized to 
receive it. If you are not the intended recipient, you are hereby notified that 
any dissemination, distribution or copying of this message and/or attachments 
is strictly prohibited. The company accepts no liability for any damage caused 
by any virus transmitted by this email. Furthermore, the company does not 
warrant a proper and complete transmission of this information, nor does it 
accept liability for any delays. If you have received this message in error, 
please contact the sender and delete the message. Thank you.
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to