Mega Code Archive

 
Categories / Python / File
 

Looping Over Characters with read Writing the Loop Differently

f = open("filename") while 1:     char = f.read(1)     if not char: break     process(char)      f.close()