欢迎光临散文网 会员登陆 & 注册

千锋教育python数据分析教程200集,Python数据分析师入门必备视频

2023-07-22 15:42 作者:bili_54598319622  | 我要投稿

Jupyter Notebook 常用快捷键

编辑模式(Enter键启动)

  • tab:代码补全或缩进
  • shift+tab:提示
  • shift+enter:运行本单元,选中下一单元
  • ctrl+enter:运行本单元
  • alt+enter:运行本单元,在下面插入下一单元

命令模式(按键esc开启)

  • shift+enter:运行本单元,选中下一单元
  • ctrl+enter:运行本单元
  • alt+enter:运行本单元,在其下插入新单元
  • y:单元转入代码状态
  • m:单元转入markdown状态
  • a:在上方插入新单元
  • b:在下方插入新单元
  • dd:删除选中的单元

其他常用快捷键

  • ctrl+a:全选
  • ctrl+z:撤销
  • ctrl+c:复制
  • ctrl+v:粘贴
  • ctrl+s:保存
  • ctrl+/:注释或者取消注释
  • shift+↑↓:选中多行

Jupyter Notebook一旦运行,会有一个内置的服务器,自动保存代码,但有时会来不及保存,可以自行点击保存

重启服务:会提示如果重启服务,所有变量都会丢失,此时所有代码运行需要手动重新运行

重启服务,然后重新运行整个代码:之前运行的输出结果会丢失,并重新运行所有代码块


IPython的使用

使用help(),获得帮助文档

help(len)
Help on built-in function len in module builtins:

len(obj, /)
 Return the number of items in a container.

也可使用?
len?

Signature: len(obj, /)
Docstring: Return the number of items in a container.
Type:  builtin_function_or_method

还可以应用到自定义的变量和自定义的函数上来返回帮助文档

def add(a,b):
 """add function"""
 return a+b
add?

Signature: add(a, b)
Docstring: add function
File:  d:\py\代码\ha\day19\<ipython-input-4-14d0432cfec9>
Type:  function

此外还可以使用两个??把函数的源代码显示出来

??

# 调用上面定义的add
add??

Signature: add(a, b)
Source: 
def add(a,b):
 """add function"""
 return a+b
File:  d:\py\代码\ha\day19\<ipython-input-4-14d0432cfec9>
Type:  function

两种用法对len来说显示没有区别

tab自动补全

  1. tab:代码补全或缩进
  2. shift+tab键:查看函数参数


千锋教育python数据分析教程200集,Python数据分析师入门必备视频的评论 (共 条)

分享到微博请遵守国家法律