csv_importer.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:fidelity-history-manager 作者: lasoren 项目源码 文件源码
def __init__(self, filepath):
        with open(filepath, "r") as f:
            lines = []
            index_line = []
            count = 0
            for line in f:
                items = line.strip().split(",")
                if len(items) > 5:
                    if count > 0:
                        lines.append(items)
                    else:
                        index_line = items
                    count += 1
            for line in lines:
                transaction = Transaction()
                transaction.process_values(index_line, line)
                self.transactions.append(transaction)
            print("{0} records found!\n".format(count))
            f.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号