diff --git a/files.html b/files.html index 79da47c..6419963 100644 --- a/files.html +++ b/files.html @@ -67,18 +67,21 @@ UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 28: chara

File Objects

-

FIXME - -

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

So far, all we know is that Python has a built-in function called open(). The open() function returns a file object, which has methods and attributes for getting information about and manipulating the file.

 >>> a_file = open('examples/chinese.txt', encoding='utf-8')
->>> a_file.name
+>>> a_file.name                                              
 'examples/chinese.txt'
->>> a_file.mode
+>>> a_file.mode                                              
 'r'
->>> a_file.encoding
+>>> a_file.encoding                                         
 'utf-8'
+
    +
  1. FIXME +
  2. +
  3. +