On Thu, 17 Mar 2005 18:37:11 -0500, Kotlin Sam <[EMAIL PROTECTED]> wrote:
>Thanks to everyone who answered my two questions. I have only submitted
>questions twice, and on both occasions the solutions were excellent,
>and, I'm emarrassed to say, much simpler than I thought they would be.
>
>My n
Thanks to everyone who answered my two questions. I have only submitted
questions twice, and on both occasions the solutions were excellent,
and, I'm emarrassed to say, much simpler than I thought they would be.
My next goal is to be able to help someone they way y'all have helped me.
Thanks aga
Kotlin Sam wrote:
Also, I frequently use something like s/^[A-Z]/~&/ to pre-pend a
tilde or some other string to the beginning of the matched string. I
know how to find the matched string, but I don't know how to change the
beginning of it while still keeping the matched part.
Something like
On Wed, 16 Mar 2005 19:06:40 -0600, rumours say that Terry Hancock
<[EMAIL PROTECTED]> might have written:
>You mean you have a text file and you want to find all the lines between
>a line starting with "start" and one starting with "end".
>lines = open('myfile', 'r').readlines()
>printing =
> "John" == John Machin <[EMAIL PROTECTED]> writes:
John> You can get gnu Windows versions of awk sed and most other
John> suchlike goodies off the net ...
Yeah, google for 'unxutils'. Cygwin versions of these tools can be a
headache sometimes.
--
Ville Vainio http://tinyurl.com/2
> "Damjan" == Damjan <[EMAIL PROTECTED]> writes:
Damjan> Or, much nicer
>> if line[:5]=='start': printing=1
Damjan> if line.startswith('start'): printing=1
>> if line[:3]=='end': printing=0
Damjan> if line.endswith('end'): printing=0
No, it's still line.startswith('e
Or, much nicer
> if line[:5]=='start': printing=1
if line.startswith('start'): printing=1
> if line[:3]=='end': printing=0
if line.endswith('end'): printing=0
--
damjan
--
http://mail.python.org/mailman/listinfo/python-list
Kotlin Sam wrote:
> I have spent so much time using sed and awk that I think that way.
Now,
> when I have to do some Python things, I am having to break out of my
> sed-ness and awk-ness, and it is causing me problems. I'm trying.
Honest!
>
> Here are the two things that I'm trying to do:
>
On Wednesday 16 March 2005 06:01 pm, Kotlin Sam wrote:
> Here are the two things that I'm trying to do:
> In sed, I can print every line between ^start to ^end by using
> /^start/,/^end/p. It's quick, easy, and doesn't take much time. Is there
> a way to do this easily in Python?
You mea
I have spent so much time using sed and awk that I think that way. Now,
when I have to do some Python things, I am having to break out of my
sed-ness and awk-ness, and it is causing me problems. I'm trying. Honest!
Here are the two things that I'm trying to do:
In sed, I can print every line be
10 matches
Mail list logo