INNER CODE UNIT · Python
cleanup
rasbt/machine-learning-book · .convert_notebook_to_script.py:17
def cleanup(path):
skip_lines_startwith = ('Image(filename=',
'# In[',
'# <hr>',
'from IPython.display import Image',
'get_ipython()',
'# <br>')
clean_content = []
imports = []
existing_imports = set()
with open(path, 'r', encoding="utf8") as f:
next(f)
next(f)
for line in f:
line = line.rstrip(' ')
if line.startswith(skip_lines_startwith):