Mega Code Archive

 
Categories / Python / File
 

Reading the entire file at once

print "\nReading the entire file at once." text_file = open("read_it.txt", "r") whole_thing = text_file.read() print whole_thing text_file.close()