One Comment

  1. Hi,

    The csv Python module is also very nice.
    For instance:

    # open csv file
    csvfile = open("test.csv")
    # read file content
    dialect = csv.Sniffer().sniff(csvfile.readline())
    # go back to the beginning
    csvfile.seek(0)
    # create a iterable object
    # dialect=dialect lets the csv module finds what is the separator
    reader = csv.DictReader(csvfile, dialect=dialect)
    # each item is a dictionary with column headers as keys
    for r in reader:
    print r.values()
    csvfile.close()

    Enjoy!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">