Read lines into a buffer : readlines « File « Python Tutorial






filePath = "input.txt"

buffer = "Readline buffer:\n"
inList = open(filePath, 'rU').readlines()
print inList
for line in inList:
    buffer += line
print buffer








12.12.readlines
12.12.1.Read all lines
12.12.2.Read lines into a buffer
12.12.3.Determining the Number of Lines in a File