(Python) programming language
- Maan Bayya
- Dec 28, 2018
- 4 min read
https://www.python.org/
* What is the programming language (Python)
Known programming language (Python), is a portable programming language, programming language and enjoy being in this vital and dynamic programming languages and free, and allow the units to follow the approach, and object-oriented programming approach (OOP), and it has been developing programming language (Python) in 1989, at the hands of (Guido van), and the participation of a large number of Volunteer developers and contributors.
* Features programming language (Python)
1 - language (Python) is a portable programming language, not only on different systems (Unix), but even on operating systems (MAC), and NexTStep, BeOS, Ms-DOS, And all versions of windows, and there is no interpreter to this new programming language called (JPython), and (Java) have been writing this compiler in the programming language, and is based on the establishment of a byte code in the Java language.
2 - programming language (Python) free programming language, and this language can be used in commercial projects without restrictions.
3 - programming language (Python) suitable for work enabled consisting of 10 lines, especially in complex projects, and containing tens of thousands of lines.
4 - way formation inter language (Python) is very simple, and this Please choose a work to develop programs in the measured speed of between 5-10 times, language C ++, Java, and this language is very easy in maintenance.
5 - language (Python) supports object-oriented programming, and is also supports multiple players and overloading genetics, objects and models, and supports the Java language, C ++.
6 - programming language (Python) is an expanded language such as Tcl, Guile, and it can be handled in the absolute ease with the language libraries C, and can be used as an extended one language to extend the programs are very complex systems.
7 - Library (Python) standard and share packages and contribute to, provide you with access to a wide range of services, such as text strings, and regular expressions, and complex expressions, idioms and correction system,Standards and Services (Unix), and files, sockets, and leads, and Internet protocols, FTP, CGI, HTML, and databases, and graphical user interfaces.
8 - language (Python) is still in constant evolution and very fast, and that the virtue of the community of users and developers, and most of those users and developers of free software supporters, and open software source, and in parallel with the main interpreter in a programming language (Python), and is written in a language C, and that have been makers (Python) of them, and there is a second written in a language interpreter Java, he is currently in the development stage.
9 - language (Python) is selected language in the XML processing.

* Communication over the network and multi-property - Multithreading
Unprecedented development proved in the Internet, and in all clarity of computers that can be very effective communication tools, and through procedure some traders to connect communication between software methods.
And we assume that you collaborate with other people, and your workstation is connected in a local area network, through the use of protocol TCP / IP, here operating system is important we do not have, for example, you can install the script (Python) on the station operates on an operating system (Linux), and enabled to communicate with another to another station, and works in the system run like (Mac) or (Windows), and can be enabled more than put on a one-stop or one device, but in separate windows.
- example
Connect the two devices, the first ready-based server in the role, and the other device is in the client role.
The server software runs continuously in the form of the unidentified device on the network, through the IP address, and is waiting for the arrival of requests sent to him by the customer, through the specified connection port property,In order to move on JavaScript it must be linked to a software object is implemented in this port, which is called socket.
And through the other program, and that the client is trying to connect through the appropriate application, and this application program is through a message sent to the network, and which must contain the demand for IP address set, and connection port to the receiver.
- Server software code
1# import socket, sys
2# HOST = '192.168.1.168'
3# PORT = 50000
4# counter =0
5# mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
6# try:
7# mySocket.bind((HOST, PORT))
8# except socket.error:
9# print("The connection socket to the chosen address failed.")
10# sys.exit
11# while 1:
12# print("Server ready, awaiting requests ...")
13# mySocket.listen(2)
14# connexion, adresse = mySocket.accept()
15# counter +=1
16# print("Client connecté, adresse IP %s, port %s" % (adresse[0], adresse[1]))
17# connexion, adresse = mySocket.accept()
18# counter +=1
19# print("Client connecté, adresse IP %s, port %s" % (adresse[0], adresse[1]))
20# msgServeur ="Vous êtes connecté au serveur Marcel. Envoyez vos messages."
21# connexion.send(msgServeur.encode("Utf8"))
22# msgClient = connexion.recv(1024).decode("Utf8")
23# while 1:
24# print("C>", msgClient)
25# if msgClient.upper() == "FIN" or msgClient =="":
26# break
27# msgServeur = input("S> ")
28# connexion.send(msgServeur.encode("Utf8"))
29# msgClient = connexion.recv(1024).decode("Utf8")
30# connexion.send("fin".encode("Utf8"))
31# print("Connexion interrompue.")
32# connexion.close()
33#
34# ch = input("<R>ecommencer <T>erminer ? ")
35# if ch.upper() =='T':
36# break
*******
- The client software code
1# import socket, sys
2# HOST = '192.168.1.168'
3# PORT = 50000
4# mySocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
5# try:
6# mySocket.connect((HOST, PORT))
7# except socket.error:
8# print("Failed connection.")
9# sys.exit()
10# print("Connection established with the server.")
11# msgServeur = mySocket.recv(1024).decode("Utf8")
12#
13# while 1:
14# if msgServeur.upper() == "FIN" or msgServeur =="":
15# break
16# print("S>", msgServeur)
17# msgClient = input("C> ")
18# mySocket.send(msgClient.encode("Utf8"))
19# msgServeur = mySocket.recv(1024).decode("Utf8")
20# print("Connexion interrompue.")
21# mySocket.close()
___________________________
* Web application, structure Website French-page thread
1# import cherrypy
2#
3# class HomePage(object):
4# def __init__(self):
5# self.maxime = MaximeDuJour()
6# self.liens = PageDeLiens()
7# def index(self):
8# return '''
9# <h3>Site des adorateurs du Python royal - Page d'accueil.</h3>
10# <p>Veuillez visiter nos rubriques géniales :</p>
11# <ul>
12# <li><a href="/entreNous">Restons entre nous</a></li>
13# <li><a href="/maxime/">Une maxime subtile</a></li>
14# <li><a href="/liens/utiles">Des liens utiles</a></li>
15# </ul>
16# '''
17# index.exposed = True
18#
19# def entreNous(self):
20# return '''
21# Cette page est produite à la racine du site.<br />
22# [<a href="/">Retour</a>]
23# '''
24# entreNous.exposed =True
25#
26# class MaximeDuJour(object):
27# def index(self):
28# return '''
29# <h3>Il existe 10 sortes de gens : ceux qui comprennent
30# le binaire, et les autres !</h3>
31# <p>[<a href="../">Retour</a>]</p>
32# '''
33# index.exposed = True
34#
35# class PageDeLiens(object):
36# def __init__(self):
37# self.extra = LiensSupplementaires()
38# def index(self):
39# return '''
40# <p>Page racine des liens (sans utilité réelle).</p>
41# <p>En fait, les liens <a href="utiles">sont plutôt ici</a></p>
42# '''
43# index.exposed = True
44#
45# def utiles(self):
46# # on peut procéder de manière ABSOLUE ou RELATIVE.
47# return '''
48# <p>Quelques liens utiles :</p>
49# <ul>
50# <li><a href="http://www.cherrypy.org">Site de CherryPy</a></li>
51# <li><a href="http://www.python.org">Site de Python</a></li>
52# </ul>
52# <p>D'autres liens utiles vous sont proposés
53# <a href="./extra/"> ici </a>.</p>
54# <p>[<a href="../">Retour</a>]</p>
55# '''
56# utiles.exposed = True
57#
58# class LiensSupplementaires(object):
59# def index(self):
60# return '''
61# <p>Encore quelques autres liens utiles :</p>
62# <ul>
63# <li><a href="http://pythomium.net">Le site de l'auteur</a></li>
64# <li><a href="http://ubuntu-fr.org">Ubuntu : le must</a></li>
65# </ul>
66# <p>[<a href="../">Retour à la page racine des liens</a>]</p>
67# '''
68# index.exposed = True
69# racine = HomePage()
70# cherrypy.quickstart(racine, config ="tutoriel.conf")
****************************
Comentários