On Fri, 13 Jul 2007, Terry Carroll wrote:
> Try this:
>
> for line in infile:
>if line.find("10.52.10.11") != -1:
> outfile.write(line)
No, don't. Alan's solution is much nicer.
___
Tutor maillist - Tutor@python.org
http://mail.python.org
On Fri, 13 Jul 2007, Que Prime wrote:
> I'm working on the following code to read a log file and output lines
> containing '10.52.10.10' but am unsure of whether to use a regular
> expression or string to achive this.
> for line in infile:
> if line #contains '10.52.10.10':
> outfile.
"Que Prime" <[EMAIL PROTECTED]> wrote
> I'm working on the following code to read a log file and output
> lines
> containing '10.52.10.10' but am unsure of whether to use a regular
> expression or string to achive this.
I tend to only use regex for patterns. If its a fixed string the
standard me
I'm working on the following code to read a log file and output lines
containing '10.52.10.10' but am unsure of whether to use a regular
expression or string to achive this. Can someone please enlighten me? Thank
you.
infile = open("in.txt","r")
outfile = open("out.txt", "w")
for line in infil