0

我想知道一个 mrjob 程序运行了多长时间。但是,unindent does not match any outer indentation level如果我在time.time()before 和 after中输入,我会得到一个错误MRWord.run(),并且我找不到任何关于此的文档。我错过了什么?

from mrjob.job import MRJob

class MRWord(MRJob):

  def mapper(self, _, line):
    x = line.split()
    yield x[0], 1

  def reducer(self, word, counts):
    yield word, sum(counts)

if __name__ == '__main__':

  t0 = time.time() 

  MRWord.run()

  print time.time() - t0
4

1 回答 1

1

检查之前的缩进t0 = time.time(),你是否混合了空格和制表符?

于 2013-09-24T03:26:54.710 回答