My Cheat on ipython 7.5

Home

1 Installation

I installed ipython by running pip install ipython without issues. I needed to start a new terminal for ipython to be seen in my path.

1.1 when using pyenv (pre 3.6)

Users/zintis/eg[7] % which ipython /Users/zintis.pyenv/shims/ipython /Users/zintis/eg[8] %

1.2 when useing venv (post 3.6)

$ which ipython
/Users/zintis/bin/python/venv-39/bin/ipython
(venv-39) /Users/zintis/bin/python/bin[509]:
$ 

2 Documentation

ipython is documented in readthedocs.io ipython tutorial is also there.

3 Tips

(most obvious ones only)

  1. history (and up and down arrows) history -n
  2. %recall n
  3. %repeat 5
  4. %rep (rep for "repeat")
  5. tab (for command completion) for example say you have a string var s, then s.<tab> will give you all the options you can run on strings like
    • s.upper()
    • s.capitalize()
    • s.join() etc…
  6. tab for commands for example import time, time.<tab>
  7. bang for shell commands i.e. !pwd or !ls
  8. list all defined variables so far: dir()
  9. list all global variables so far: globals()
  10. list all local variables so far: locals()

3.1 Home