jupyter notebook--常用操作记录
一、jupyter notebook中魔法操作
1.将本地的.py文件load到jupyter的一个cell中
%load test.py
2.从网络load代码到jupyter
%load http://.....,
3.jupyter中运行python文件
%run file.py
4.python程序中中文注释
#--*-- coding:utf-8 --*--
5.在jupyter notebook中以命令行形式运行python命令,安装包等
!python --version #查看python版本
!python test.py #执行test.py程序文件
! pip install opencv2 # 安装程序
6.获取当前的工作空间current working directory
!current_path = %pwd
7.使用matplotlib绘图
%matplotlib inline
8.在jupyter中设置link
[需要添加链接的文字](#the_destination)
需要在要跳转到的位置添加下面语句:
<a id = 'the_destination'> </a>
9.在jupyter notebook中添加目录功能
利用Anaconda安装Jupyter Notebook extensions
conda install -c conda-forge jupyter_contrib_nbextensions
二、jupyter中常用快捷键
执行当前cell,并自动跳到下一个cell:Shift Enter
执行当前cell,执行后不自动调转到下一个cell:Ctrl-Enter
是当前的cell进入编辑模式:Enter
退出当前cell的编辑模式:Esc
删除当前的cell:双D
为当前的cell加入line number:单L
将当前的cell转化为具有一级标题的maskdown:单1
将当前的cell转化为具有二级标题的maskdown:单2
将当前的cell转化为具有三级标题的maskdown:单3
为一行或者多行添加/取消注释:Crtl /
撤销对某个cell的删除:z
浏览器的各个Tab之间切换:Crtl PgUp和Crtl PgDn
快速跳转到首个cell:Crtl Home
快速跳转到最后一个cell:Crtl End