On Thu, 2010-03-04 at 10:39 -0800, Pete Emerson wrote:
I am looking for advice along the lines of an easier way to do this
or a more python way (I'm sure that's asking for trouble!) or
people commonly do this instead or here's a slick trick or oh,
interesting, here's my version to do the same
Pete Emerson wrote:
I've written my first python program, and would love suggestions for
improvement.
I'm a perl programmer and used a perl version of this program to guide
me. So in that sense, the python is perlesque
This script parses /etc/hosts for hostnames, and based on terms given
on
Jean-Michel Pichavant jeanmic...@sequans.com wrote:
You've already been given good advices.
Unlike some of those, I don't think using regexp an issue in any way.
Yes they are not readable, for sure, I 100% agree to that statement, but
you can make them readable very easily.
# not
Duncan Booth wrote:
Jean-Michel Pichavant jeanmic...@sequans.com wrote:
You've already been given good advices.
Unlike some of those, I don't think using regexp an issue in any way.
Yes they are not readable, for sure, I 100% agree to that statement, but
you can make them readable very
Jean-Michel Pichavant jeanmic...@sequans.com wrote:
And tell me how not using regexp will ensure the /etc/hosts processing
is correct ? The non regexp solutions provided in this thread did not
handled what you rightfully pointed out about host list and commented
lines.
It won't make is
Thanks for your response, further questions inline.
On Mar 4, 11:07 am, Tim Wintle tim.win...@teamrubber.com wrote:
On Thu, 2010-03-04 at 10:39 -0800, Pete Emerson wrote:
I am looking for advice along the lines of an easier way to do this
or a more python way (I'm sure that's asking for
On Mar 5, 7:00 am, Duncan Booth duncan.bo...@invalid.invalid wrote:
Jean-Michel Pichavant jeanmic...@sequans.com wrote:
And tell me how not using regexp will ensure the /etc/hosts processing
is correct ? The non regexp solutions provided in this thread did not
handled what you rightfully
On Fri, 2010-03-05 at 07:53 -0800, Pete Emerson wrote:
Thanks for your response, further questions inline.
On Mar 4, 11:07 am, Tim Wintle tim.win...@teamrubber.com wrote:
On Thu, 2010-03-04 at 10:39 -0800, Pete Emerson wrote:
I am looking for advice along the lines of an easier way to do
On Mar 5, 10:53 am, Pete Emerson pemer...@gmail.com wrote:
Thanks for your response, further questions inline.
On Mar 4, 11:07 am, Tim Wintle tim.win...@teamrubber.com wrote:
On Thu, 2010-03-04 at 10:39 -0800, Pete Emerson wrote:
I am looking for advice along the lines of an easier way to
On Mar 5, 10:19 am, sjdevn...@yahoo.com sjdevn...@yahoo.com wrote:
On Mar 5, 10:53 am, Pete Emerson pemer...@gmail.com wrote:
Thanks for your response, further questions inline.
On Mar 4, 11:07 am, Tim Wintle tim.win...@teamrubber.com wrote:
On Thu, 2010-03-04 at 10:39 -0800, Pete
I've written my first python program, and would love suggestions for
improvement.
I'm a perl programmer and used a perl version of this program to guide
me. So in that sense, the python is perlesque
This script parses /etc/hosts for hostnames, and based on terms given
on the command line (argv),
Pete Emerson wrote:
I've written my first python program, and would love suggestions for
improvement.
I'm a perl programmer and used a perl version of this program to guide
me. So in that sense, the python is perlesque
This script parses /etc/hosts for hostnames, and based on terms given
on
On Mar 4, 2:30 pm, MRAB pyt...@mrabarnett.plus.com wrote:
Pete Emerson wrote:
I've written my first python program, and would love suggestions for
improvement.
I'm a perl programmer and used a perl version of this program to guide
me. So in that sense, the python is perlesque
This
On Thu, Mar 4, 2010 at 10:39 AM, Pete Emerson pemer...@gmail.com wrote:
#!/usr/bin/python
More common:
#!/usr/bin/env python
import sys, fileinput, re, os
filename = '/etc/hosts'
hosts = []
for line in open(filename, 'r'):
match = re.search('\d+\.\d+\.\d+\.\d+\s+(\S+)', line)
On Mar 4, 1:39 pm, Pete Emerson pemer...@gmail.com wrote:
I've written my first python program, and would love suggestions for
improvement.
I'm a perl programmer and used a perl version of this program to guide
me. So in that sense, the python is perlesque
This script parses /etc/hosts for
Great responses, thank you all very much. I read Jonathan Gardner's
solution first and investigated sets. It's clearly superior to my
first cut.
I love the comment about regular expressions. In perl, I've reached
for regexes WAY too much. That's a big lesson learned too, and from my
point of view
16 matches
Mail list logo