Python




Expertise (2/5)



Il y a quelques années j’ai utilisé Python quelques mois dans le cadre d’un projet autour de l’outil ZOP.

Récemment, j’ai utilisé Python pour développer un outil destiné à automatiser la procédure de cassage d’une clé WEP. Le script est disponible sur ce lien : wep-cracker.


Impression

Manipulation de chaîne

Les boucles

Les tests

Les fonctions

Les listes

Les dictionnaires

Manipulation de fichier

Expressions régulières

Les sockets

Les modules

Just like other languages (such as C, C++, Perl, ...), it is possible to define modules. Modules may be compared to the libraries for C.

import module_name

Python will search for the file "module_name.py". If this file is not in the current directory, or in the standard Python's module path, then the Python interpreter will look in the list of directories specified by the environment variable PYTHONPATH. PYTHONPATH is a list of colon (:) separated directory paths.

Note that all the functions or variables in the module "module_name" can be called by using the notation: "module_name.function_name". If you want to get rid of the module name ("module_name"), then you can use the following notation:

from module_name import function1 function2

This will allow you to call function1 and function2 without the leading "module_name.". But all other functions or variables from the module "module_name" will not be exported (this means that you can't call them, even if you use the leading "module_name.".

If you want to export everything from a module, you can use:

from module_name import *

This will allow you to call any functions or variables from the module module_name without the leading "module_name.".