def remove_outputs(nb):
 for ws in nb.worksheets:
  for cell in ws.cells:
   if (cell.cell_type == 'code'):
    cell.outputs = []
    if ('prompt_number' in cell):
     del cell['prompt_number']

def remove_outputs ( nb ) : for ws in nb . worksheets : for cell in ws . cells : if ( cell . cell_type == 'code' ) : cell . outputs = [ ] if ( 'prompt_number' in cell ) : del cell [ 'prompt_number' ]
remove the outputs from a notebook .