Le Mon, 27 Apr 2009 23:29:13 -0400,
Dan Liang danlian...@gmail.com s'exprima ainsi:
Hi Bob, Shantanoo, Kent, and tutors,
Thank you Bob, Shantanoo, Kent for all the nice feedback. Exception
handling, the concept of states in cs, and the use of the for loop with
offset helped a lot. Here is
Hi Bob, Shantanoo, Kent, and tutors,
Thank you Bob, Shantanoo, Kent for all the nice feedback. Exception
handling, the concept of states in cs, and the use of the for loop with
offset helped a lot. Here is the code I now have, based on your suggestions,
and it does what I need:
ListLines = [
On Sat, Apr 25, 2009 at 2:11 PM, Dan Liang danlian...@gmail.com wrote:
Hi Bob and tutors,
Thanks Bob for your response! currently I have the current code, but it does
not work:
ListLines= []
for line in open('test.txt'):
line = line.rstrip()
ListLines.append(line)
This could be
Dear Tutors,
I have a file from which I want to extract lines that end in certain strings
and print to a second file. More specifically, I want to:
1) iterate over each line in the file, and if it ends in yes, print it.
2) move to the line following the one described in #1 above, and if it ends
Dan Liang wrote:
Dear Tutors,
I have a file from which I want to extract lines that end in certain
strings and print to a second file. More specifically, I want to:
1) iterate over each line in the file, and if it ends in yes, print it.
2) move to the line following the one described in #1
Hi Bob and tutors,
Thanks Bob for your response! currently I have the current code, but it does
not work:
ListLines= []
for line in open('test.txt'):
line = line.rstrip()
ListLines.append(line)
for i in range(len(ListLines)):
if ListLines[i].endswith(yes) and
On 25-Apr-09, at 11:41 PM, Dan Liang wrote:
Hi Bob and tutors,
Thanks Bob for your response! currently I have the current code, but
it does not work:
ListLines= []
for line in open('test.txt'):
line = line.rstrip()
ListLines.append(line)
for i in range(len(ListLines)):
if
Dan Liang wrote:
Hi Bob and tutors,
Thanks Bob for your response! currently I have the current code, but
it does not work:
[snip]
Thank you for code, sample data and more complete specs.
Lines in the file look like following:
word1 word2 word3 word4 yes
word1 word2 word3 word4 no