How to#

Create a new directory using the command line#

In the command line the mkdir command (short for “make directory) can be used to create a new directory.

Tip

$ mkdir <directory>

For example to create a director called scripts:

$ mkdir scripts

See the contents of a directory in the command line#

In the command line we can see the contents of the current directory:

  • On Windows using dir

  • On OS X using ls

Tip

Run python code in a file#

To run code in a file we type python followed by the name of the file in the command line.

Tip

$ python <file.py>

For example to run code in a file called main.py:

$ python main.py

How to run python code without using a file or Jupyter#

At the command line if you type python without passing a filename this will create a prompt in which you can directly write Python code.

Tip

$ python

When doing this, we see a prompt appear with >>>, we can directly type python code in there and press enter:

>>> 2 + 2
4

Attention

This interface to Python is called a Read-Eval-Print-Loop and is often referred to as a REPL.

Using python is the simplest of REPLs, there are others (for example ipython).

Attention

This interface to Python is quite limited and should only be used for quick access to Python as a way to run simple commands.

Install VScode plugins#

VScode is a powerful editor with a number of plugins for different languages and functionalities.

To install a particular plugin in the menu bar, click on Code > Preferences > Extensions.

From there you can search for a specific plugin and install it by clicking on the install button.

Click the toggle (“Click to Show”) to see a demo of this: