Python 2.7 vs 3.3:读取文件所需的时间大幅增加

时间:2013-03-04 20:54:22

标签: python python-2.7 python-3.3

出于某种原因,我不得不降级到2.7。 这段简单的代码花了不到一秒的时间来读取python 3.3中大约100,000条记录的文件

with open(fileName) as sourceFile:
    for line in sourceFile:
        tempDict = self.createPositionLadderHash(line.rstrip().split(","))
        self.addToPositionsDictionary(tempDict)
    return self.POSITIONS_MAP

然而,在降级到2.7后,它将花费超过5秒。我做错了吗?

0 个答案:

没有答案