Re: N00b question: matching stuff with variables.

2010-06-29 Thread Tim Golden
On 29/06/2010 15:14, Stephen Hansen wrote: True: but I've personally never seent he point of the csv module unless we're talking about a more complicated csv format, such as one with quoting in fields. I don't know if that's what the OP is working with, but good point: csv might be a good approac

Re: N00b question: matching stuff with variables.

2010-06-29 Thread Stephen Hansen
On 6/29/10 2:51 AM, Sion Arrowsmith wrote: Stephen Hansen wrote: On 6/28/10 10:29 AM, Ken D'Ambrosio wrote: for line in file: match = re.search((seek)",(.*),(.*)", line) # Stuck here [ ... ] name, foo, bar = line.split(",") if seek in name: # do something with foo and

Re: N00b question: matching stuff with variables.

2010-06-29 Thread Sion Arrowsmith
Stephen Hansen wrote: >On 6/28/10 10:29 AM, Ken D'Ambrosio wrote: >> for line in file: >> match = re.search((seek)",(.*),(.*)", line) # Stuck here > [ ... ] > name, foo, bar = line.split(",") > if seek in name: > # do something with foo and bar > >That'll return True if the wo

Re: N00b question: matching stuff with variables.

2010-06-28 Thread Rami Chowdhury
On Monday 28 June 2010 10:29:35 Ken D'Ambrosio wrote: > Hi, all. I've got a file which, in turn, contains a couple thousand > filenames. I'm writing a web front-end, and I want to return all the > filenames that match a user-input value. In Perl, this would be something > like, > > if (/$value/

Re: N00b question: matching stuff with variables.

2010-06-28 Thread Stephen Hansen
On 6/28/10 10:29 AM, Ken D'Ambrosio wrote: Hi, all. I've got a file which, in turn, contains a couple thousand filenames. I'm writing a web front-end, and I want to return all the filenames that match a user-input value. In Perl, this would be something like, if (/$value/){print "$_ matches\n

Re: N00b question: matching stuff with variables.

2010-06-28 Thread Thomas Jollans
On 06/28/2010 07:29 PM, Ken D'Ambrosio wrote: > Hi, all. I've got a file which, in turn, contains a couple thousand > filenames. I'm writing a web front-end, and I want to return all the > filenames that match a user-input value. In Perl, this would be something > like, > > if (/$value/){print

N00b question: matching stuff with variables.

2010-06-28 Thread Ken D'Ambrosio
Hi, all. I've got a file which, in turn, contains a couple thousand filenames. I'm writing a web front-end, and I want to return all the filenames that match a user-input value. In Perl, this would be something like, if (/$value/){print "$_ matches\n";} But trying to put a variable into regex