<DIV>Hey just wondering y this does not work .. i am tryin to read from a file and it returns a list of all lines from a file except lines with a '#'. The lines returned also must not end with new-line chars. Can any one help? </DIV>
<DIV>thanx =)</DIV>
<DIV> </DIV>
<DIV>import string<BR>import sys</DIV>
<DIV> </DIV>
<DIV>true = 1<BR>false = 0</DIV>
<DIV><BR>def readlines(filename):</DIV>
<DIV> infile = open("test.txt", "r")<BR> while 1:<BR> text = infile.readlines()<BR> if text == "":<BR> break<BR> if text[0] == '#':<BR> continue<BR> if not text:<BR> break<BR> text = text.rstrip()</DIV>
<DIV> infile.close()<BR> return text</DIV><p><hr SIZE=1>
Do you Yahoo!?<br>
Free <a href="http://us.rd.yahoo.com/mail_us/tag/*http://calendar.yahoo.com">online calendar</a> with sync to Outlook(TM).