
- Jupyter Tutorial
- Jupyter - Home
- IPython
- IPython - Introduction
- IPython - Installation
- IPython - Getting Started
- Running & Editing Python Script
- IPython - History Command
- IPython - System Commands
- IPython - Command Line Options
- Dynamic Object Introspection
- IPython - IO Caching
- Setting IPython as Default Python Environment
- Importing Python Shell Code
- IPython - Embedding IPython
- IPython - Magic Commands
- Jupyter
- Project Jupyter - Overview
- Jupyter Notebook - Introduction
- Working With Jupyter Online
- Installation and Getting Started
- Jupyter Notebook - Dashboard
- Jupyter Notebook - User Interface
- Jupyter Notebook - Types of Cells
- Jupyter Notebook - Editing
- Jupyter Notebook - Markdown Cells
- Cell Magic Functions
- Jupyter Notebook - Plotting
- Converting Notebooks
- Jupyter Notebook - IPyWidgets
- QtConsole
- QtConsole - Getting Started
- QtConsole - Multiline Editing
- QtConsole - Inline Graphics
- QtConsole - Save to Html
- QtConsole - Multiple Consoles
- Connecting to Jupyter Notebook
- Using github and nbviewer
- JupyterLab
- JupyterLab - Overview
- Installation & Getting Started
- JupyterLab - Interface
- JupyterLab - Installing R Kernel
- Jupyter Resources
- Jupyter - Quick Guide
- Jupyter - Useful Resources
- Jupyter - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
IPython - System Commands
If the statement in the input cell starts with the exclamation symbol (!), it is treated as a system command for underlying operating system. For example, !ls (for linux) and !dir (for windows) displays the contents of current directory

The output of system command can also be assigned to a Python variable as shown below −

The variable stores output without colors and splits at newline characters.
It is also possible to combine Python variables or expressions with system command calls. Variable in curly brackets {} can be embedded in command text. Observe the following example −

Here is another example to understand that prefixing Python variable with $ also achieves the same result.

Advertisements