This article details how to use ipython in python to improve code development efficiency. it is very helpful for you to use python. if you need it, you can refer to it for reference.
I. INTRODUCTION to IPython
IPython is an interactive Python interpreter and is more efficient.
Unlike most traditional working modes (edit-> compile-> run), it adopts the following working modes: Execution-> exploration, while most of the generation related to data analysis
Code contains exploratory operations (such as trial and iteration methods), so IPython can greatly improve the coding efficiency.
Since the development of IPython, it is not just an enhanced version of Python shell, it integrates the GUI console, which allows you to directly perform drawing operations; it also has a Web-based notebook and a lightweight fast parallel computing engine.
2. write code
Enter ipython in Terminal to start IPython.
If you need to use the Matplotlib library, you need to mark the integration of the Matplotlib package at startup, then the startup command is changed to: ipython -- pylab
1. learn to use the Tab key
When you enter the code, if this is a previously entered content (such as the variable defined earlier ), you only need to press the Tab key after entering the first few letters to automatically complete.
IPython has this function as a major improvement to the standard Python shell, which is already very common in IDE in other languages.
It can not only automatically complete variables and objects, but also automatically complete the file path as if you typed the command in Terminal.
2. press the up and down arrow keys to quickly enter history commands.
When a command or code needs to be repeatedly input, you do not have to manually repeat it each time. you only need to use the up arrow to automatically complete the previous command; then press the arrow key to run the preceding command.
If you need to press the arrow key multiple times to find a command, you only need to enter the first few letters of the command and then press the arrow key to filter only the commands that match the first few letters.
3. execute a. py file.
If you want to execute an external. py file, use the % run command, for example:
For more Python articles about how to use IPython to improve development efficiency, please follow the PHP Chinese network!