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: gagsl-...@yahoo.com.ar [mailto:gagsl-...@yahoo.com.ar] 
Sent: Thursday, March 05, 2009 10:41 AM
To: Raju, Abhinayaraj
Cc: python-list@python.org
Subject: Re: Help required to read and print lines based on the type of first 
character


De: "abhinayaraj.r...@emulex.com" <abhinayaraj.r...@emulex.com>

> 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

Reply via email to