Re: [Tutor] Searching through files for values

2015-08-14 Thread Alan Gauld
On 14/08/15 05:07, Jason Brown wrote: for file_list in filenames: with open(file_list) as files: for items in vals: for line in files: Others have commented on your choice of names. I'll add one small general point. Try to match the plurality of your names to the nat

Re: [Tutor] Searching through files for values

2015-08-14 Thread Peter Otten
Jason Brown wrote: > (accidentally replied directly to Cameron) > > Thanks, Cameron. It looks like that value_file.close() tab was > accidentally tabbed when I pasted the code here. Thanks for the > suggestion > for using 'with' though! That's will be handy. > > To test, I tried manually spec

Re: [Tutor] Searching through files for values

2015-08-14 Thread Jason Brown
(accidentally replied directly to Cameron) Thanks, Cameron. It looks like that value_file.close() tab was accidentally tabbed when I pasted the code here. Thanks for the suggestion for using 'with' though! That's will be handy. To test, I tried manually specifying the list: vals = [ 'value1',

Re: [Tutor] Searching through files for values

2015-08-13 Thread Cameron Simpson
On 13Aug2015 16:48, Jason Brown wrote: I'm trying to search for list values in a set of files. The goal is to generate a list of lists that can later be sorted. I can only get a match on the first value in the list: contents of value_file: value1 value2 value3 ... The desired output is: fil

[Tutor] Searching through files for values

2015-08-13 Thread Jason Brown
Hi, I'm trying to search for list values in a set of files. The goal is to generate a list of lists that can later be sorted. I can only get a match on the first value in the list: contents of value_file: value1 value2 value3 ... The desired output is: file1 value1 file1 value2 file2 value3 f