Created
September 21, 2010 15:16
-
-
Save Motoma/589834 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# CSVFileHandler.py | |
import csv | |
class CSVFileHandler: | |
def __init__(self, filename): | |
self.open(filename) | |
def __del__(self): | |
self.close() | |
def open(self, filename): | |
self.file = open(filename, 'r') | |
self.reader = csv.reader(self.file) | |
def close(self): | |
self.file.close() | |
def process(self, function, args): | |
for row in self.reader: | |
function(row, args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment