Programme de l’événement ANDROID

La faculté des sciences de GAFSA et plus  particulièrement le club Développeurs FSGF et L’HORIZON vous invitent à atteindre une formation et des Workshop  portant sur la programmation Android.
Prière d’apporter vos portatifs pour ceux qui veulent participer.
Cet événement peut mener à une certification.
Donc veuillez participer le plus tôt possible.
PS :Le nombre de participants est limité et l’inscription est gratuite

How to Enable Code Syntax Highlighting for Python in the Nano Text Editor

 

Code can be written in any old text editor. Even Windows Notepad will do. I am writing this guide for Linux users because everyone who has been in the programming sessions have switched to Arch, or some other form of Linux, and Windows users can just use Notepad++.

You have a choice when it comes to how you want to type code. We can use a simple syntax highlighting editor (like we are preparing to do) or we could use an IDE (Intergrated Development Environment). An IDE has all sorts of features (code completion), but they tend to be bloated.

Today’s I’m going to focus on syntax highlighting. Syntax highlighting is a helpful feature that will color code certain significant words in a given programming language. This makes code easier to read and keep organized. Here is an example of what we are going to make the nano text editor appear as below when it displays Python code.

 

Requirements

Text in bold is a terminal command.

  • Installed copy of nano
        sudo pacman -S nano
  • Linux OS

Create a .nanorc File with Syntax Highlighting Scripts

  1. In your home directory, we need to create a .nanorc file, because it likely doesn’t exist. If it does, just edit it.
        cd ~/ && nano .nanorc
  2. Open another terminal. We are going to use the default Python script for nano.
        cat /usr/share/nano/python.nanorc
  3. Paste the contents into your .nanorc file. You can also use this command.
        sudo echo $(cat /usr/share/python.nanorc) >>  ~/.nanorc
  4. Now, exit your terminal, and open another.
        nano test.py
  5. Start typing Python-related commands, like print and you will see them become highlighted. Pretty cool, eh?

<

p>ch33rs 😀