IPython
- IPython - Magic Commands
- IPython - Embedding IPython
- Importing Python Shell Code
- Setting IPython as Default Python Environment
- IPython - IO Caching
- Dynamic Object Introspection
- IPython - Command Line Options
- IPython - System Commands
- IPython - History Command
- Running & Editing Python Script
- IPython - Getting Started
- IPython - Installation
- IPython - Introduction
Jupyter
- Jupyter Notebook - IPyWidgets
- Converting Notebooks
- Jupyter Notebook - Plotting
- Cell Magic Functions
- Jupyter Notebook - Markdown Cells
- Jupyter Notebook - Editing
- Jupyter Notebook - Types of Cells
- Jupyter Notebook - User Interface
- Jupyter Notebook - Dashboard
- Installation and Getting Started
- Working With Jupyter Online
- Jupyter Notebook - Introduction
- Project Jupyter - Overview
QtConsole
- Using github and nbviewer
- Connecting to Jupyter Notebook
- QtConsole - Multiple Consoles
- QtConsole - Save to Html
- QtConsole - Inline Graphics
- QtConsole - Multiline Editing
- QtConsole - Getting Started
JupyterLab
- JupyterLab - Installing R Kernel
- JupyterLab - Interface
- Installation & Getting Started
- JupyterLab - Overview
Jupyter Resources
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
IPython - Running and Editing Python Script
In this chapter, let us understand how to run and edit a Python script.
Run Command
You can use run command in the input prompt to run a Python script. The run command is actually pne magic command and should actually be written as %run. However, the %automagic mode is always on by default, so you can omit this.
In [1]: run hello.py Hello IPython
Edit Command
IPython also provides edit magic command. It invokes default editor of the operating system. You can open it through Windows Notepad editor and the script can be edited. Once you close it after saving its input, the output of modified script will be displayed.
In [2]: edit hello.py Editing... done. Executing edited code... Hello IPython welcome to interactive computing
Note that hello.py initially contained only one statement and after editing one more statement was added. If no file name is given to edit command, a temporary file is created. Observe the following code that shows the same.
In [7]: edit IPython will make a temporary file named: C:UsersacerAppDataLocalTempipython_edit_4aa4vx8fipython_edit_t7i6s_er.py Editing... done. Executing edited code... magic of IPython Out[7]: print ("magic of IPython")Advertisements