I want to read a huge file in my code. Is read() or readline() faster for this. How about the loop:
for line in fileHandle
If file is huge, read() is definitevely bad idea, as it loads (without size parameter), whole file into memory.
Readline reads only one line at time, so I would say that is better choice for huge files.
And just iterating over file object should be as effective as using readline.
See http://docs.python.org/tutorial/inputoutput.html#methods-of-file-objects for more info
Neither. Both of them will read the content into memory. In case of big files, iterating over the file object only loads one line of your file at a time and is perhaps a good way to deal with the contents of a huge file.