Thank you for the suggestions.
Some little reading gave the idea and it works well too. :)
Here is the code:
fileIN = open("test.txt")
count = 0
for line in fileIN:
data= line
if '####' in data:
count = 4
elif '###' in data:
count = 3
elif '##' in data:
count = 2
elif '#' in data:
count = 1
elif data.find('#') == -1:
count = 0
if (count == 0):
print data + '\nlooks like a code line...\n'
elif(count== 4):
print data + '\ninvalid line!\n'
elif count>=1:
for i in range(0, count):
print data
Thanks,
R Abhinayaraj
-----Original Message-----
From: [email protected] [mailto:[email protected]]
Sent: Thursday, March 05, 2009 10:41 AM
To: Raju, Abhinayaraj
Cc: [email protected]
Subject: Re: Help required to read and print lines based on the type of first
character
De: "[email protected]" <[email protected]>
> I am sorry to that I am not able to fully grasp it. Could you help me with
> some more details?
> How can I identify each line and utilize the interactive interpreter?
You really should read the tutorial at http://docs.python.org/tut
(or any other introductory text; see http://wiki.python.org/moin/BeginnersGuide
for more references)
To open the interpreter, just type "python" (no quotes; <ENTER> to execute) on
the command prompt.
--
Gabriel Genellina
Yahoo! Cocina
Recetas prácticas y comida saludable
http://ar.mujer.yahoo.com/cocina/
--
http://mail.python.org/mailman/listinfo/python-list