Re: [Tutor] search through a list

2005-07-04 Thread nephish
Danny Yoo wrote: > > >>#this function returns the number of lines on record for each log file. >>def line_finder(LogsInDir, flag): >>flag=flag.strip() >>return_next=False >>for line in LogsInDir: >>if return_next: >>return line.strip() >>else: >>if lin

Re: [Tutor] search through a list

2005-07-04 Thread Danny Yoo
> #this function returns the number of lines on record for each log file. > def line_finder(LogsInDir, flag): > flag=flag.strip() > return_next=False > for line in LogsInDir: > if return_next: > return line.strip() > else: > if line.strip() == flag: >

[Tutor] search through a list

2005-07-03 Thread nephish
Hey there, sorry to bother you again about this same problem but i have a line of code in this same issue that works in idle but it does not work in a regular script. that same thing i am trying to do, reading the directory, comparing the list of files to a list . just want to catch the newes

[Tutor] search through a list

2005-07-03 Thread nephish
Hey there thanks, quote: /try num_of_lines = line_find(LogsRead, "PV050614.LOG") I am binding num_of_lines to the return value. In an interactive session, without the binding, a non-None return value will display on screen. But both interactively and in a program binding it makes it easier t

Re: [Tutor] search through a list

2005-07-03 Thread Sandip Bhattacharya
nephish wrote: > LogList = open('home/nephish/Projects/Piv/logs/LogList.txt', 'r') > LogsRead = LogList.readlines() > > #see if there is a new log file. > for i in LogFiles: > if LogFiles[i] not in LogList: Don't you mean "if LogFiles[i] not in LogsRead" ? - Sandip -- Sandip Bhattacharya

Re: [Tutor] search through a list

2005-07-03 Thread Light
> import os > > #get a list of Logs in logs folder > LogFiles = os.listdir('/home/nephish/Projects/Piv_GCI/logs') > > #open the loglist file and read the lines > LogList = open('home/nephish/Projects/Piv/logs/LogList.txt', 'r') > LogsRead = LogList.readlines() > > #see if there is  a new log file.

Re: [Tutor] search through a list

2005-07-03 Thread Brian van den Broek
nephish said unto the world upon 02/07/2005 23:41: > hey there > i have a file that i want to read. > each line in the file is the name of a file. > the next line is how many lines are in that file. > > example of loglist.txt > > log1.txt > 232 > log2.txt > 332 > log3.txt > 223 > > so log1 is a

[Tutor] search through a list

2005-07-02 Thread nephish
hey there i have a file that i want to read. each line in the file is the name of a file. the next line is how many lines are in that file. example of loglist.txt log1.txt 232 log2.txt 332 log3.txt 223 so log1 is a text file that has 232 lines in it. ok, so what i want to do is read this file,