[Tutor] WRITING XLS FROM OS.WALK()

Hilton Fernandes hgfernan at gmail.com
Sat Oct 9 00:41:01 CEST 2010


Hi !

Being Python as rich in libraries, probably there's already a library
to create .XLS files.

Before finding that, you can try the CSV format: simply put a comma to
separate any fields you want in your values.

And of course, a comma will finish your line.

That way, Excel or any other spreadsheet program will understand what
you want them to understand.

All the best,
hilton

On Fri, Oct 8, 2010 at 6:08 PM, Walter Prins <wprins at gmail.com> wrote:
>
>
> On 8 October 2010 20:34, Susana Iraiis Delgado Rodriguez
> <susana.delgado_s at utzmg.edu.mx> wrote:
>>
>> Hello members:
>> I developed a Python module to make a list which contains all the files
>> ending with .shp and .dbf extensions, I have solved this already, but now I
>> want to write an excel file from it. The file should show the full path from
>> the found files. This is the code:
>>
>> import os
>> a = open ("directorio.xls","w")
>
>
> Excel (.xls) is not a text format.  What you've written opens
> "directorio.xls" as a text file.
>
> If you want to write an Excel format file, have a look at the xlwt (and the
> xlrt for reading) Python modules. See http://www.python-excel.org/
>
> Walter
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


More information about the Tutor mailing list