The developers of IPython absorbed the basic concepts of the standard interpreter, made a lot of improvements on this basis, and created an amazing tool. It says this on its homepage: "This is an enhanced interactive Python shell." It has tab completion, object introspection, a powerful history mechanism, embedded source code editing, integrated Python debugger, and %run mechanism. Macros, the ability to create multiple environments and invoke system shells.
The biggest difference between IPython and standard Python is that Ipython numbers each line of the command prompt. (Recommended learning: Python video tutorial)
As shown below:
The difference between python shell and ipython :
python shell cannot save history after exiting;
ipython history is automatically saved:
is saved in Under the history.sqlite file:
You can use "_", "__", and "___" to call the last three records;
Python shell does not support tab auto-completion;
ipython supports tab completion;
python shell cannot quickly obtain class and function information;
ipython displays the object signature, document string, and code location through "?", and displays the source code through "??";
python shell cannot directly execute shell commands and needs to use sys ;
ipython calls system commands through "!", such as "!uptime";
(5) Others
ipython has many magic function, can be enumerated by using %lsmagic;
%run: run python file
�it: use the editor to open the current function for editing
%save: save a certain Save some history records to the file
�bug: Activate the debug program
%timeit: Get the program execution time
%paste: Get the clipboard file and execute it, best With %cpaste, you can interrupt it with Ctrl C
For more Python-related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of The difference between ipython and python. For more information, please follow other related articles on the PHP Chinese website!