All pastes #473233 Raw Edit

Untitled

public text v1 · immutable
·published 2007-05-06 03:29 UTC
rendered paste body
import sys

file = open('test','r')

# what i want to do
#while( line = file.readline() ):
#	print line

# or maybe something like this.. but with more flavor
#line = [None]
#while( file.readinto(line)):
#	print line[0]

file.seek(0)

# what i want to avoid
while True:
	line = file.readline()
	if not line:
		break
	sys.stdout.write(line)

file.seek(0)

# what i also want to avoid
for line in file.readlines():
    sys.stdout.write(line)

file.close()