Open a file for reading : open « File « Python Tutorial

inPath = "input.txt"

file = open(inPath, 'rU')
if file:
    print "Error Opening File."
12.9.1.Access Modes for File Objects
12.9.2.'r' is the default processing mode
12.9.3.Open a file for reading
12.9.4.Open a file for writing
12.9.5.Opening a Nonexistent File
12.9.6.Opening a File and check its mode
12.9.7.Reading and Writing