[EMAIL PROTECTED] wrote: > f = open("textfile","rU") > while (1): > line = f.readline().strip() > if line == '': > break > print line > f.close()
Be warned that your code doesn't read the whole file if that file contains lines with only whitespace characters. If you want to print every line, change the loop to while 1: line = f.readline() if line == "": break print line.strip() i. e. don't strip() the line until you have tested for an empty string. The idiomatic way to loop over the lines in a file is for line in f: print line.strip() Peter -- http://mail.python.org/mailman/listinfo/python-list