Mercurial > hg > numerics
view numerics/csvwriter.py @ 177:c2c86c37eadd
this now works on Mac
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Thu, 10 Mar 2016 13:05:24 -0800 |
parents | 7927d7127f9a |
children |
line wrap: on
line source
#!/usr/bin/env python # -*- coding: utf-8 -*- import csv string = (str, unicode) __all__ = ['CSVWriter'] class CSVWriter(object): """a more sensible front-end to writing CSV files""" def __init__(self, f, mode='a'): if isinstance(f, string): f = open(f, mode) self.f = f self.writer = csv.writer(f) def __call__(self, *data): self.writer.writerow(data) self.f.flush()