CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

| Download

Python Data Science Handbook

Views: 92280
1
import os
2
3
import nbformat
4
5
from generate_contents import iter_notebooks, NOTEBOOK_DIR
6
7
def fix_kernelspec():
8
for nb_name in iter_notebooks():
9
nb_file = os.path.join(NOTEBOOK_DIR, nb_name)
10
nb = nbformat.read(nb_file, as_version=4)
11
12
print("- Updating kernelspec for {0}".format(nb_name))
13
nb['metadata']['kernelspec']['display_name'] = 'Python 3'
14
15
nbformat.write(nb, nb_file)
16
17
18
if __name__ == '__main__':
19
fix_kernelspec()
20
21