Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def select_cell(notebook, out_value):
- """
- returns the information of a cell
- """
- # Notebook formatting defintions
- if notebook["nbformat"] < 4:
- cell_all = list(notebook["worksheets"][0]["cells"])
- key_counter = 'prompt_number'
- else:
- cell_all = list(notebook["cells"])
- key_counter = 'execution_count'
- # Finding and returning the relevant cell
- for icell, cell in enumerate(cell_all):
- try: # Not all Cells have the `key_counts`
- if cell[key_counter] == out_value:
- return cell
- except:
- None
- return None
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement