On Wed, 09 Jul 2008 09:59:32 -0700, norseman wrote:
I would use:
readthem= 0
file=open(filename,'r')
while readthem == 0:
line=file.readline()
if not line:
break
if 'Item 1' in line:
readthem= 1
# print line # uncomment if 'Item 1' is to be printed
Here's a simple way to do it with a minimum amount of loopiness (don't
forget to use 'try-except' or 'with' in real life):
f = open(item1.txt)
for preline in f:
if Item 1 in preline:
print preline,
for goodline in f:
# could put an end condition with a 'break'
On Jul 10, 2:45 pm, jstrick [EMAIL PROTECTED] wrote:
Here's a simple way to do it with a minimum amount of loopiness (don't
forget to use 'try-except' or 'with' in real life):
f = open(item1.txt)
for preline in f:
if Item 1 in preline:
print preline,
for goodline in f:
On Jul 10, 4:54 pm, Iain King [EMAIL PROTECTED] wrote:
On Jul 10, 2:45 pm, jstrick [EMAIL PROTECTED] wrote:
Here's a simple way to do it with a minimum amount of loopiness (don't
forget to use 'try-except' or 'with' in real life):
f = open(item1.txt)
for preline in f:
if Item 1
I am a starter in python and would like to write a program that reads
lines starting with a line that contains a certain word.
For example the program starts reading the program when a line is
encountered that contains 'item 1'
The weather is nice
Item 1
We will go to the seaside
...
Only the
antar2 wrote:
I am a starter in python and would like to write a program that reads
lines starting with a line that contains a certain word.
For example the program starts reading the program when a line is
encountered that contains 'item 1'
The weather is nice
Item 1
We will go to the
On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote:
I am a starter in python and would like to write a program that reads
lines starting with a line that contains a certain word.
For example the program starts reading the program when a line is
encountered that contains 'item 1'
The weather
On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote:
I am a starter in python and would like to write a program that reads
lines starting with a line that contains a certain word.
For example the program starts reading the program when a line is
encountered that contains 'item 1'
The weather
On 2008-07-09, antar2 [EMAIL PROTECTED] wrote:
I am a starter in python and would like to write a program that reads
lines starting with a line that contains a certain word.
For example the program starts reading the program when a line is
encountered that contains 'item 1'
The weather is
Tim Cook wrote:
On Wed, 2008-07-09 at 03:30 -0700, antar2 wrote:
I am a starter in python and would like to write a program that reads
lines starting with a line that contains a certain word.
For example the program starts reading the program when a line is
encountered that contains 'item 1'
10 matches
Mail list logo