Re: [Tutor] Simple question on creating a filter

2005-02-11 Thread Danny Yoo
On Fri, 11 Feb 2005, Smith, Jeff wrote: > I'm sorry to both with such a simple question but I've looked in the > normal places and don't see the quick and dirty answer I know must > exist. > > I want to write a simple line selection filter that could be used like: > > filter < file > > I get the

Re: [Tutor] Simple question on creating a filter

2005-02-11 Thread Alan Gauld
> In Perl I would do: > > while (<>) > { > print if line meets selection criteria; > } You may want to check out the fileinput module. It takes care of multiple files being passed as input and such like too. > for line in sys.stdin: > if line meets selection criteria: > print line >for line

RE: [Tutor] Simple question on creating a filter

2005-02-11 Thread Smith, Jeff
t, I've had the same problem with Perl but because of my newbie status I assumed I was doin' something wrong :-) -Original Message- From: Bill Mill [mailto:[EMAIL PROTECTED] Sent: Friday, February 11, 2005 9:38 AM To: Smith, Jeff Cc: tutor@python.org Subject: Re: [Tutor] Simple q

Re: [Tutor] Simple question on creating a filter

2005-02-11 Thread Bill Mill
On Fri, 11 Feb 2005 09:28:35 -0500, Smith, Jeff <[EMAIL PROTECTED]> wrote: > I'm sorry to both with such a simple question but I've looked in the > normal places and don't see the quick and dirty answer I know must > exist. > No worries; that's what this list is for. > I want to write a simple l

[Tutor] Simple question on creating a filter

2005-02-11 Thread Smith, Jeff
I'm sorry to both with such a simple question but I've looked in the normal places and don't see the quick and dirty answer I know must exist. I want to write a simple line selection filter that could be used like: filter < file In Perl I would do: while (<>) { print if line meets selec