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('end'), not
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/2prnb
--
On Wed, 16 Mar 2005 19:06:40 -0600, rumours say that Terry Hancock
[EMAIL PROTECTED] might have written:
snip
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.
snip
lines = open('myfile', 'r').readlines()
printing =
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
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
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 next
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
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 mean
:
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?
Also, I frequently use something like s/^[A-Z]/~/ to pre-pend a
tilde
or some other string to the beginning
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
10 matches
Mail list logo