Working with File Objects : File Object « File « Python






Working with File Objects

# Python has a built-in function, open, for opening a file on disk. 
# open returns a file object, which has methods and attributes for getting 
# information about and manipulating the opened file.

f = open("aFile.txt", "rb")        

print f                                            

print f.mode                                       

print f.name                                       
           
       








Related examples in the same category