マジックコマンドとショートカットキーを身につける

shift+enterで実行し下のセルに移動

esc+bで下にセルを挿入。esc+aで上にセルを挿入。enterで編集モード。

esc+mでMarkdownセルに変更

マジックコマンド一覧を確認


In [2]:
%lsmagic


Out[2]:
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  %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  %store  %sx  %system  %tb  %time  %timeit  %unalias  %unload_ext  %who  %who_ls  %whos  %xdel  %xmode

Available cell magics:
%%!  %%HTML  %%SVG  %%bash  %%capture  %%debug  %%file  %%html  %%javascript  %%js  %%latex  %%perl  %%prun  %%pypy  %%python  %%python2  %%python3  %%ruby  %%script  %%sh  %%svg  %%sx  %%system  %%time  %%timeit  %%writefile

Automagic is ON, % prefix IS NOT needed for line magics.

現在のディレクトリを確認


In [3]:
%pwd


Out[3]:
'/Users/ry8128/workspace/study_python'

コマンドの説明を確認するには?をつける


In [4]:
%pwd?

In [5]:
%%javascript
IPython.toolbar.add_button_group([
{
    'label':'renumber all code cells',
    'icon':'icon-list-ol',
    'callback':function() {
        var cells = IPython.notbook.get_cells();
        cells = cells.filter(function(c)
        {
            return c instanceof IPython.CodeCell;
        })
        for (var i = 0; i < cells.length; i++) {
            cells[i].set_input_prompt(i+1);
        }
    }
}]);



In [ ]: