background preloader

7 Python Libraries you should know about

7 Python Libraries you should know about
In my years of programming in Python and roaming around GitHub's Explore section, I've come across a few libraries that stood out to me as being particularly enjoyable to use. This blog post is an effort to further spread that knowledge. I specifically excluded awesome libs like requests, SQLAlchemy, Flask, fabric etc. because I think they're already pretty "main-stream". If you know what you're trying to do, it's almost guaranteed that you'll stumble over the aforementioned. This is a list of libraries that in my opinion should be better known, but aren't. 1. pyquery (with lxml) pip install pyquery For parsing HTML in Python, Beautiful Soup is oft recommended and it does a great job. Just how slow? What immediately stands out is how fast lxml is. So either slow and easy to use or fast and hard to use, right? Wrong! Enter PyQuery Oh PyQuery you beautiful seductress: from pyquery import PyQuerypage = PyQuery(some_html) last_red_anchor = page('#container > a.red:last') Easy as pie. 2. dateutil

Python Django tutorial 1 installing easy_install, virtualenv & django No Studying After 5pm: Using Parkinson's Law to Kick Procrastination's Ass I’ve recently made four lifestyle changes that have allowed me to get more done and put much more effort into everything I do, all while feeling great with very little stress. I sleep 8 hours a dayI work out for an hour every weekdayI hide all clocks while I’m workingI don’t do anything related to academics on Saturdays and past 5pm on weekdays My main focus of this post is the last two, but I’ll briefly address the first two because I think they’re very important. Sleep I read a lot of what tech entrepreneurs have to say, and I’ve noticed a trend. Working more hours in a day doesn’t necessarily correlate with getting more done. Exercise I also made a habit of going to the gym every day from 5-6pm. Parkinson’s Law But my real trick for getting more done with much less stress is in the things that I don’t do. Work expands so as to fill the time available for its completion.— Cyril Northcote Parkinson Focus Scott H. Distractions Cover the clocks So I eliminate clocks whenever I’m working.

The Django Book polls - What is the best comment in source code you have ever encountered The Python Standard Library — Python v2.7.5 documentation This document is for an old version of Python that is no longer supported. You should upgrade and read the Python documentation for the current stable release. Navigation 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. Python’s standard library is very extensive, offering a wide range of facilities as indicated by the long table of contents listed below. The Python installers for the Windows platform usually include the entire standard library and often also include many additional components. In addition to the standard library, there is a growing collection of several thousand components (from individual programs and modules to packages and entire application development frameworks), available from the Python Package Index. Previous topic 9. Next topic 1. This Page Show Source Quick search

language agnostic - What's your most controversial programming opinion Python Extension Packages for Windows - Christoph Gohlke by Christoph Gohlke, Laboratory for Fluorescence Dynamics, University of California, Irvine. This page provides 32- and 64-bit Windows binaries of many scientific open-source extension packages for the official CPython distribution of the Python programming language. The files are unofficial (meaning: informal, unrecognized, personal, unsupported, no warranty, no liability, provided "as is") and made available for testing and evaluation purposes. If downloads fail reload this page, enable JavaScript, disable download managers, disable proxies, clear cache, and use Firefox. Most binaries are built from source code found on PyPI or in the projects public revision control systems. Refer to the documentation of the individual packages for license restrictions and dependencies. Use pip version 8 or newer to install the downloaded .whl files. Install numpy+mkl before other packages that depend on it. The files are provided "as is" without warranty or support of any kind. Build Environment

How To Reverse a Linked List (3 Different Ways) Introduction There are a couple of ways to reverse a linked list. One of them requires knowledge of pointers and one of them is pretty straight forward. Technique 1 In this way, a new linked list will be created and all the items of the first linked list will be added to the new linked list in reverse order. public void ReverseLinkedList (LinkedList linkedList) { LinkedList copyList = new LinkedList(); LinkedListNode start = linkedList.Tail; while (start ! This way is probably the most inefficient among the three. Technique 2 In this method, we will swap linked list node objects (references to the data). Assuming we have N nodes in the link list: Swap: 1st node’s object with Nth node’s object Swap: 2nd node’s object with (N-1)th node’s object Swap: 3rd node’s object with (N-2)th node’s object After swapping: Swapping goes on until the middle of the linked list is found. This way of reversing a linked list is pretty optimized and pretty fast. Technique 3 Conclusion

Welcome to Jinja2 — Jinja2 2.8-dev documentation Jinja2 is a modern and designer friendly templating language for Python, modelled after Django’s templates. It is fast, widely used and secure with the optional sandboxed template execution environment: <title>{% block title %}{% endblock %}</title><ul>{% for user in users %} <li><a href="{{ user.url }}">{{ user.username }}</a></li>{% endfor %}</ul> Features: sandboxed executionpowerful automatic HTML escaping system for XSS preventiontemplate inheritancecompiles down to the optimal python code just in timeoptional ahead of time template compilationeasy to debug. Additional Information If you can’t find the information you’re looking for, have a look at the index or try to find it using the search function:

Leasing a Car Overview" Some of the sweetest car lease deals have dried up -- especially since automakers began offering zero-percent and low-rate financing to entice buyers. Even so, leasing remains an attractive alternative to buying a new vehicle for many motorists. Half of all luxury cars are still leased, as are more than 20 percent of vehicles in general. For most consumers, leasing a new vehicle every two or three years would be more expensive than buying one and keeping it after the final payment. Other consumers are quite content to lease a vehicle they could never afford to buy, even if it doesn't necessarily save money. Leasing has two principal benefits: (1) You can drive a newer vehicle that is always under warranty and seldom needs more than routine maintenance, and (2) you can often get a larger, more luxurious, better-equipped car. In this article, we'll help you get a better understanding of this alternative to buying, making it easier to decide whether leasing makes sense for you.

Related: