Your syntax is a bit off, your assignment inside the while statement is invalid syntax:
f = open('test.dat', 'r')
while True:
ch=f.read(1)
if not ch: break
print ch
This will start the while loop, and break it when there are no characters left to read! Give it a try.