Opening a File and check its mode : open « File « Python Tutorial






f = open("test.txt", "rb")      
print f                                              
print f.mode                                        
print f.name








12.9.open
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