出于某种原因,我不得不降级到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秒。我做错了吗?