快生活 - 生活常识大全

系列魔术种类


  讲解对象:【Colab系列】魔术种类
  作者:融水公子 rsgz
  文章出处:360doc个人图书馆[其他平台均为盗版]
  ipython中魔术有两种:行魔术和单元魔术
  行魔术
  特点:命令以一个%字符开头
  参数:参数仅扩展到当前行的末尾
  单元魔术
  特点:
  1 使用%%作为标记
  2 单元魔术只能用作单元格的第一行
  3 每个单元只能使用一个单元魔术
  参数:将声明其所在的当前行和整个单元作为参数
  实例1:
  %lsmagic
  作用:列出所有可用的魔术,将显示当前定义的行魔术和单元魔术
  运行结果:
  Available line magics:%alias %alias_magic %autocall %automagic %autosave %bookmark %cat %cd %clear %colors %config %connect_info %cp %debug %dhist %dirs %doctest_mode %ed %edit %env %gui %hist %history %killbgscripts %ldir %less %lf %lk %ll %load %load_ext %loadpy %logoff %logon %logstart %logstate %logstop %ls %lsmagic %lx %macro %magic %man %matplotlib %mkdir %more %mv %notebook %page %pastebin %pdb %pdef %pdoc %pfile %pinfo %pinfo2 %pip %popd %pprint %precision %profile %prun %psearch %psource %pushd %pwd %pycat %pylab %qtconsole %quickref %recall %rehashx %reload_ext %rep %rerun %reset %reset_selective %rm %rmdir %run %save %sc %set_env %shell %store %sx %system %tb %tensorflow_version %time %timeit %unalias %unload_ext %who %who_ls %whos %xdel %xmodeAvailable cell magics:%%! %%HTML %%SVG %%bash %%bigquery %%capture %%debug %%file %%html %%javascript %%js %%latex %%perl %%prun %%pypy %%python %%python2 %%python3 %%ruby %%script %%sh %%shell %%svg %%sx %%system %%time %%timeit %%writefileAutomagic is ON, % prefix IS NOT needed for line magics.
  谢谢大家的支持!可以点击我的头像,进入我的空间浏览更多文章呢
  ---
网站目录投稿:山天