美文网首页
Jupyter Notebook笔记

Jupyter Notebook笔记

作者: JUNjianshuZHU | 来源:发表于2018-08-22 13:37 被阅读0次

隐藏代码code

# 手动点击隐藏1
from IPython.display import display_html
display_html("""<button onclick="$('.input, .prompt, .output_stderr, .output_error').toggle();">点击隐藏代码</button>""", raw=True)
# 手动点击隐藏2
from IPython.display import HTML

HTML('''<script>
code_show=true; 
function code_toggle() {
 if (code_show){
 $('div.input').hide();
 } else {
 $('div.input').show();
 }
 code_show = !code_show
} 
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()"><input type="submit" value="Click here to toggle on/off the raw code."></form>''')
# 自动隐藏
from IPython.display import display
from IPython.display import HTML
import IPython.core.display as di       # Example: di.display_html('<h3>%s:</h3>' % str, raw=True)

# This line will hide code by default when the notebook is exported as HTML
di.display_html('<script>jQuery(function() {if (jQuery("body.notebook_app").length == 0) { jQuery(".input_area").toggle(); jQuery(".prompt").toggle();}});</script>', raw=True)

# This line will add a button to toggle visibility of code blocks, for use with the HTML export version
di.display_html('''<button onclick="jQuery('.input_area').toggle(); jQuery('.prompt').toggle();">Toggle code</button>''', raw=True)

修改安装路径

  • cmd中输入jupyter notebook --generate-config,->输入"N"
  • 打开jupyter_notebook_config.py,将c.NotebookApp.notebook_dir = 'D:'

相关文章

网友评论

      本文标题:Jupyter Notebook笔记

      本文链接:https://www.haomeiwen.com/subject/auaeiftx.html