Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I use <a href="http://docs.python.org/library/csv.html" rel="nofollow">sniff</a> to autodetect it:</p> <pre><code>import csv dialect = csv.Sniffer().sniff(file.readline()) file.seek(0) file.readline() file.seek(0) fieldnames=( 'assignatura', 'professor', 'grup', ) reader = csv.DictReader(file, fieldnames=fieldnames, dialect=dialect ) for row in reader: codiFranja = unicode(row['assignatura'],'iso-8859-1') ... </code></pre> <p><strong>EDITED:</strong></p> <p>If you are planning to create a csv from python and read it from excel, then you need to create file with locale delimiter. But python csv module don't use locale: <a href="http://mail.python.org/pipermail/csv/2003-May/000507.html" rel="nofollow">http://mail.python.org/pipermail/csv/2003-May/000507.html</a> </p> <blockquote> <p>Andreas> This could be really simple to implement using the locale module. But I took a short look at the locale module and it seems like there is no way to get the list separator sign (probably it's not POSIX complaint).</p> </blockquote> <p>A workaround may be to write delimiters on a configuration file on each python user client instalation based on locale desktop computer and read this delimiters when python make csv file.</p> <p>Also you can write vbscript code that creates and excel file and exports it to csv then look for delimiter each time that you need to create your python csv file.</p> <p>Perhaps the most elegant solution is to use schema.ini: <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms709353(v=vs.85).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/windows/desktop/ms709353(v=vs.85).aspx</a> . You can generate the csv file and, in the same foleder, schema.ini file.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload