background preloader

Python

Facebook Twitter

20.16. urlparse — Parse URLs into components — Python 2.7.8 documentation. Note The urlparse module is renamed to urllib.parse in Python 3.

20.16. urlparse — Parse URLs into components — Python 2.7.8 documentation

The 2to3 tool will automatically adapt imports when converting your sources to Python 3. Source code: Lib/urlparse.py This module defines a standard interface to break Uniform Resource Locator (URL) strings up in components (addressing scheme, network location, path etc.), to combine the components back into a URL string, and to convert a “relative URL” to an absolute URL given a “base URL.” The module has been designed to match the Internet RFC on Relative Uniform Resource Locators.

New in version 2.5: Support for the sftp and sips schemes. The urlparse module defines the following functions: Python - How to download file from ftp? 20.5. urllib — Open arbitrary resources by URL — Python 2.7.8 documentation. Open a network object denoted by a URL for reading.

20.5. urllib — Open arbitrary resources by URL — Python 2.7.8 documentation

If the URL does not have a scheme identifier, or if it has file: as its scheme identifier, this opens a local file (without universal newlines); otherwise it opens a socket to a server somewhere on the network. If the connection cannot be made the IOError exception is raised. 20.8. ftplib — FTP protocol client — Python 2.7.8 documentation. Source code: Lib/ftplib.py This module defines the class FTP and a few related items.

20.8. ftplib — FTP protocol client — Python 2.7.8 documentation

The FTP class implements the client side of the FTP protocol. You can use this to write Python programs that perform a variety of automated FTP jobs, such as mirroring other ftp servers. It is also used by the module urllib to handle URLs that use FTP. For more information on FTP (File Transfer Protocol), see Internet RFC 959. Here’s a sample session using the ftplib module: The module defines the following items: class ftplib.FTP([host[, user[, passwd[, acct[, timeout]]]]]) How to download a file via FTP with Python ftplib. Python. The Python Tutorial — Python v2.6.5 documentation. Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming.

Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms. The Python interpreter and the extensive standard library are freely available in source or binary form for all major platforms from the Python web site, and may be freely distributed. The same site also contains distributions of and pointers to many free third party Python modules, programs and tools, and additional documentation. The Python interpreter is easily extended with new functions and data types implemented in C or C++ (or other languages callable from C). This tutorial introduces the reader informally to the basic concepts and features of the Python language and system. The Glossary is also worth going through. DatabaseProgramming. Apprendre à programmer avec Python - Club des décideurs et profe. Les bases de données sont des outils de plus en plus fréquemment utilisés.

Apprendre à programmer avec Python - Club des décideurs et profe

Elles permettent de stocker des données nombreuses dans un seul ensemble bien structuré. Lorsqu'il s'agit de bases de données relationnelles, il devient en outre tout à fait possible d'éviter l'« enfer des doublons ». Vous avez sûrement été déjà confrontés à ce problème : Des données identiques ont été enregistrées dans plusieurs fichiers différents. Lorsque vous souhaitez modifier ou supprimer l'une de ces données, vous devez ouvrir et modifier tous les fichiers qui la contiennent ! Les bases de données constituent la solution à ce type de problème. Il existe de nombreux types de bases de données.

Si la liste n'est pas trop longue, et si l'on ne souhaite pas pouvoir y effectuer des recherches en fonction de critères complexes, il va de soi que l'on peut accéder à ce type de données en utilisant des instructions simples, telles celles que nous avons abordées page 108. MySQL-Python. Package Index : MySQL-python 1.1.10. Python SQL Database Access System. Python - MySQL Database Access. DatabaseInterfaces. This page lists database interfaces available for Python.

DatabaseInterfaces

It may also help in finding a suitable database engine for you to use in your Python database applications. The Python standard for database interfaces is the Python DB-API (PEP 249) Most Python database interfaces adhere to this standard. Most databases have ODBC support; see the section below on ODBC modules. Java databases usually support JDBC, and can be used from Jython. How to connect to a MySQL database from python. Python Database API Specification v2.0. Writing MySQL Scripts with Python DB-API. Paul DuBoispaul@kitebird.com Document revision: 1.02 Last update: 2006-09-17 Table of Contents Python is one of the more popular Open Source programming languages, owing largely to its own native expressiveness as well as to the variety of support modules that are available to extend its capabilities.

Writing MySQL Scripts with Python DB-API

One of these modules is DB-API, which, as the name implies, provides a database application programming interface. DB-API is designed to be relatively independent of details specific to any given database engine, to help you write database-access scripts that are portable between engines. DB-API's design is similar to that used by Perl and Ruby DBI modules, the PHP PEAR DB class, and the Java JDBC interface: It uses a two-level architecture in which the top level provides an abstract interface that is similar for all supported database engines, and a lower level consisting of drivers for specific engines that handle engine-dependent details.

MySQLdb Installation. Command shell access within Python - comp.lang.python.