#!/usr/bin/python infile = open("test.txt", 'r') # test file is short, read the whole thing # note: the newlines will be part of the lines read, # so either strip them or don't print additional newlines # when printing out lines = infile.readlines() infile.close() for line in lines: print line,