Hi, this is a module i wrote to catch some data from a csv file: ########## #module csv data reader # open a csv file and return its data
import csv import sys def __init__(self): rawdata = [] f = open('datalisting_000.csv','r') try: reader = csv.reader(f) for row in reader: rawdata.append(row) finally: f.close() def rawdata(): return rawdata if __name__ == "__main__": print "This is a module. You can't run it directly. Try to import it." raw_input("\n\nPress any key to exit.") ######### But when i try to use like: ########## import csvdatareader print csvdatareader.rawdata() ########## It didn't print anything. Where is the mistake? Cheers.
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor