Issue
Answering questions Stack Overflow, I use the same ipython notebook, which makes its easier to search previously given answers.
The notebook is starting to slow down. The question I have is: How do I count the numbers of cells in the notebook?
Solution
- I recommend you don't use the same ipython notebook for everything. If using multiple notebooks would lead to repeat code, you should be able to factor out common functionality into actual python modules which your notebooks can import.
- the notebook is just a json file, if you read the file as a json you can do it easily.
For example:
import json
document = json.load(open(filepath,'r'))
for worksheet in document['worksheets']:
print len(worksheet['cells'])
Answered By - exp1orer
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.