淡淡回忆 发表于 2017-4-30 14:06:10

python 生成器 yield

  def __xlsx2tuples(self, path):
  '''ganerator tuples from xlsx file
  '''
  wb = load_workbook(path)
  sheets = wb.get_sheet_names()
  for sheet in sheets:
  ws = wb.get_sheet_by_name(sheet)
  for row in ws.rows:
  row_list = []
  for cell in row:
  row_list.append(cell.value)
  yield tuple(row_list)
页: [1]
查看完整版本: python 生成器 yield