Skip to content

Instantly share code, notes, and snippets.

View ffreitasalves's full-sized avatar
🎯
Focusing

Fernando Freitas Alves ffreitasalves

🎯
Focusing
View GitHub Profile
@ffreitasalves
ffreitasalves / modify_notebooks.py
Created July 29, 2020 01:10
Modifying multiple existent Ipython Notebooks using nbformat API
import os
import nbformat
warning_message = '### Developers warning: This notebook was generated using XPTO'
nb_warning_cell = nbformat.v4.new_markdown_cell(warning_message)
for root, dirs, files in os.walk("."):
for file in files:
if file[-6:] == '.ipynb':
nb_path = os.path.join(root, file)
current_nb = nbformat.read(nb_path, as_version=4)