background preloader

Python

Facebook Twitter

Python MySQL DB

Python MySQL Database Access. The Python standard for database interfaces is the Python DB-API. Most Python database interfaces adhere to this standard. You can choose the right database for your application. Python Database API supports a wide range of database servers such as − GadFlymSQLMySQLPostgreSQLMicrosoft SQL Server 2000InformixInterbaseOracleSybase Here is the list of available Python database interfaces: Python Database Interfaces and APIs .You must download a separate DB API module for each database you need to access. For example, if you need to access an Oracle database as well as a MySQL database, you must download both the Oracle and the MySQL database modules. The DB API provides a minimal standard for working with databases using Python structures and syntax wherever possible. Importing the API module.Acquiring a connection with the database.Issuing SQL statements and stored procedures.Closing the connection We would learn all the concepts using MySQL, so let us talk about MySQLdb module. #!

Example #! #! Core Python Cheat Sheet from DZone Refcardz. By: Naomi Ceder and Mike Driscoll Python is an interpreted dynamically typed Language. Python uses indentation to create readable, even beautiful, code. Python comes with so many libraries that you can handle many jobs with no further libraries. Python fits in your head and tries not to surprise you, which means you can write useful code almost immediately. Python was created in 1990 by Guido van Rossum. While the snake is used as totem for the language and community, the name actually derives from Monty Python and references to Monty Python skits are common in code examples and library names.

There are several other popular implementations of Python, including PyPy (JIT compiler), Jython (JVM integration) and IronPython (.NET CLR integration). Python 2.x vs. Python comes in two basic flavors these days – Python 2.x (currently 2.7) and Python 3.x (currently 3.3). Language Features Programming as Guido intended it... Indentation rules in Python. Comments and docstrings #! Branching Loops Books. Transforming Code into Beautiful, Idiomatic Python. Python from Scratch - Creating a Dynamic Website. Python Training - Getting Started with Python. Python Web Development: Understanding Django for Beginners. Able Pear Software: Bundling Python files into a stand-alone executable. One of the problems with building a medium to large sized program in Python (or similar scripting languages) is distributing it to users. When a Python script grows beyond a couple hundred lines, most programmers prefer to split that single script file into multiple Python modules and packages.

For an individual developer, modules and packages are primarily an aid in mental organization, though they also ease navigating around the project. For a large Python program being developed by a team, modules and packages are an important way to communicate the structure and intent of the code. Unfortunately, distributing a multi-module Python program has a number of problems. First, you must carefully assemble all your program's dependencies in a single directory tree. Python has long included the distutils module to help developers distribute Python code. Virtualenv is still overkill for end users, technical or not, who simply want to run your program in order to get their work done. . $ . Able Pear Software: Bundling Python files into a stand-alone executable. SL4A Script Launcher. This free demo version is meant for evaluation purposes. Please be aware of the limitations, which are:- Watermark on rendered videos- Expires after 30 days Full version: Video Toolbox is a video editor app that provides a set of tools to do the simple things you want with videos on your Android phone or tablet: rotate, trim, flip, resize, and convert.

Supports editing all media formats created by Android camera (camcorder) apps as well as some additional formats. Input formats: MP4, 3GP, M4V, WebM, MKV, OGV, AVI, MOV, FLV, WMV, MPG, ASF Output formats: MP4, WebM, MKV, AVI, MOV, FLV Please disable task killers; they can interfere with a long rendering process. Video Toolbox isn't a traditional linear video creator with a timeline, although it allows you to simply edit and convert your videos. About the tools Rotator tool:Rotating a video clockwise or counterclockwise, rotation by 90, 180, or 270 degrees. Python's Django vs Ruby on Rails. Python vs Ruby Ruby is a dynamic, reflective, object-oriented general-purpose programming language which was designed and developed in the mid-1990s.

Compared to Python, which treats code readability above everything else, the philosophy behind Ruby is that programmers should have the flexibility, freedom and power to write concise and compact code. The most important difference between Python and Ruby is that the philosophy of Python requires almost everything explicitly defined by a programmer while Ruby allows the programmer to write code with implicit behaviour inherited from other components. For example, in Ruby, the self in instance methods is implicitly defined while Python requires self to be the first argument declared into an instance method.

In the example code above, the class Hello contains two instance methods hello() and call_hello(). Ruby on Rails Overview Unsurprisingly, the implicit philosophy of Ruby also impacts how Rails was designed. Convention over Configuration.

Python IDEs

The Python Standard Library. While The Python Language Reference describes the exact syntax and semantics of the Python language, this library reference manual describes the standard library that is distributed with Python. It also describes some of the optional components that are commonly included in Python distributions. Python’s standard library is very extensive, offering a wide range of facilities as indicated by the long table of contents listed below.

The library contains built-in modules (written in C) that provide access to system functionality such as file I/O that would otherwise be inaccessible to Python programmers, as well as modules written in Python that provide standardized solutions for many problems that occur in everyday programming. Some of these modules are explicitly designed to encourage and enhance the portability of Python programs by abstracting away platform-specifics into platform-neutral APIs. The Python Tutorial. 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. Testing Flask Applications — Flask 0.10.1 documentation. Something that is untested is broken. The origin of this quote is unknown and while it is not entirely correct, it is also not far from the truth.

Untested applications make it hard to improve existing code and developers of untested applications tend to become pretty paranoid. If an application has automated tests, you can safely make changes and instantly know if anything breaks. Flask provides a way to test your application by exposing the Werkzeug test Client and handling the context locals for you. You can then use that with your favourite testing solution. In this documentation we will use the unittest package that comes pre-installed with Python. The Application First, we need an application to test; we will use the application from the Tutorial. The Testing Skeleton In order to test the application, we add a second module (flaskr_tests.py) and create a unittest skeleton there: The code in the setUp() method creates a new test client and initializes a new database.

The First Test. Archive. Python Web Applications With Flask - Part I. Please note: This is a collaboration piece between Michael Herman, from Real Python, and Sean Vieira, a Python developer from De Deo Designs. Articles in this series: Updated: November 17th, 2013 Recently, thanks to an awesome gig, I re-introduced myself to Flask, which is "a microframework for Python".

It is a great little framework; unfortunately, like Sinatra (which inspired it), making the transition from small "self-contained" applications to larger applications is difficult. After reviewing the available tutorials out there I thought, "there must be a better way" - then I saw Miguel Grinberg's mega-tutorial. What we are building This series will be following the development of a web analytics solution called Flask-Tracking. Register with the application.Add sites to their account.Install tracking codes on their site(s) to track various events as the events occur.View reports on their site(s)' event activity. Starting off First principles The Zen of Python >>> import this Acronym explosion. Build your own website: Python vs. Ruby. Why pay someone else to build your website? You know what you want, so don't waste the time and money it takes to get someone else to understand what you want. Sure they could do it faster, but is that worth giving up all that control?

And what happens when something goes wrong? Are you going to call someone every time you need to update it? Coding is a tremendously powerful skill to develop. Python and Ruby were released in the early 1990s, around the time the web was born. Too Much Ruby If you took a look at that infographic you can see a few things stand out. Although Python has been around longer, there are many more Ruby on Rails bootcamps, tutorials, etc. online and ITRW (“in the real world” aka meatspace as opposed to cyberspace).

Why Python Is Better There's no question that both Ruby on Rails and Python, using a web application framework like web2py or Django, are equally great at building websites. Kickstarting Real Python for Web Development. Documentation. Readability is a primary focus for Python developers, in both project and code documentation. Following some simple best practices can save both you and others a lot of time. Project Documentation A README file at the root directory should give general information to both users and maintainers of a project. It should be raw text or written in some very easy to read markup, such as reStructuredText or Markdown. It should contain a few lines explaining the purpose of the project or library (without assuming the user knows anything about the project), the URL of the main source for the software, and some basic credit information.

An INSTALL file is less necessary with Python. A LICENSE file should always be present and specify the license under which the software is made available to the public. A TODO file or a TODO section in README should list the planned development for the code. Project Publication Sphinx Sphinx is far and away the most popular Python documentation tool. Note Other Tools.