Mercurial > hg > numerics
view numerics/csvwriter.py @ 92:5b25e0be78aa
wip
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Mon, 02 Mar 2015 16:08:39 -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()