On Wednesday 14 May 2008 23:55:06 Uwe Stöhr wrote: > Attached is a new CSV2lyx importer written mainly by Hartmut Haase. > It uses Python's built in CSV reader that is available since Python 2.3. I > added a method to automatically detect the correct column separator. > > There are only minor tweaks to do I think. I'm sending it that the Python > masters could have a look at the basic design - I'm sure you find some > optimizations ;-)
I have improved the options reading. Using the optparse module from the python standard library the code becomes easier to read. The next is to validate the input, I took the validation to all elements. Instead of using our method to decide what is the column delimiter I have used the csv sniffer (that is the method name, not my fault). :-) I have extended the code to write to standard output, I could have in a similar vein had extended it to read from the standard input. Sometimes it is helpful to do it general. > Attached are some small testfiles made with OpenOffice that allows you to > specify the column separator when creating CSV files. Uwe could you, please, test it. According to my tests it gives the same results for the proposed files. > regards Uwe -- José Abílio
csv2lyx.py
Description: application/python