Read a file with open command

jean-jeanot jean.moser at neuf.fr
Fri Aug 11 12:39:23 EDT 2006


Sorry, but the access mode is not binary with XP Windows.  Finally for
reading the file it is necessary to use a slash or a double backslash.
If the file is a simple textfile, using a backslash is perhaps not
recommended but it is functionning.
Anyway many thanks.Here is the program:

>>> file_obj= open ("D:/Mes documents/ADB Anna.ods",'r')
>>> s = file_obj
>>> s.readlines()

Jean-Jeanot

Jan Svec a écrit :

> Hi,
> simply use file_obj = open ("D:\My documents\File.ods",'rb') for
> opening file in binary access mode, which is required for binary files
> on MS Windows.
> Honza
>
> jean-jeanot wrote:
> > I can access to a file with the command:
> > file_obj = open ( " D:\My documents\Textfile.txt",'r')
> >
> > When I now try to read a file with the following command:
> >
> > file_obj = open ("D:\My documents\File.ods",'r') it doesn't function.
> > The extension ods is coming from OpenOffice.org Calc.
> > 
> > Why ?
> > 
> > jean-jeanot




More information about the Python-list mailing list