Python Patterns & Practices

Find The Best Answers To Your Python Coding Problems



python - All nodeValue fields are None when parsing XML

python - Django: How to create a model dynamically just for testing

Is there a way to make a user-defined Python function act like a built-in statement?

garbage collection - How to know when to manage resources in Python

Loading bundled python framework dependencies using only python

Finding first and last index of some value in a list in Python

python - How to embed p tag inside some text using Beautifulsoup?

optimization - Shortening a oft-used code segment for testing a return value in Python

html - How to use storeHtmlSource in python code (Selenium RC)

python - Store Django form.cleaned_data in null model field?

Python: Read a file (from an external server)

Why am I getting the following error in Python "ImportError: No module named py"?

deployment - How to deploy a Python application with libraries as source with no further dependencies?

localization - What is the best way to internationalize a Python app with multiple i18n domains?

python - Is there a way to decode numerical COM error-codes in pywin32

python - Running SimpleXMLRPCServer in separate thread and shutting down

inheritance - Python super() raises TypeError

multithreading - input and thread problem, python

python - How can I get only class variables?

how to hook to events / messages in windows using python

python - How can I pass all the parameters to a decorator?

numpy - How do I simulate biased die in python?

python - Finding the workspace size (screen size less the taskbar) using GTK

python - Given an rpm package name, query the yum database for updates

python - Is there a more pythonic way to build this dictionary?

python - How can I make this recursive crawl function iterative?

python - wxpython auinotebook close tab event

user interface - How to modify existing panels in Maya using MEL or Python?

arrays - Initializing a list to a known number of elements in Python

inheritance - Validating Python Arguments in Subclasses

linux - Need to build (or otherwise obtain) python-devel 2.3 and add to LD_LIBRARY_PATH

multithreading - python conditional lock

pretty print - How do I get python's pprint to return a string instead of printing?

python - How do you order lists in the same way QuerySets are ordered in Django?

How to modularize a Python application

events - Detect in python which keys are pressed

multithreading - How to debug deadlock with python?

is there a string method to capitalize acronyms in python?

python - Bad Pickle get error

modeling - Simple simulations for Physics in Python?

sorting - Comparison function in Python using Lambdas

winapi - MS Outlook CDO/MAPI Blocking Python File Output?

Inheritance and Overriding __init__ in python

Need to route instance calls inside a python class

python - Best practice for integrating CherryPy web-framework, SQLAlchemy sessions and lighttpd to serve a high-load webservice

python - How to get the concrete class name as a string?

Understanding Python Class instances

python - Select mails from inbox alone via poplib

regex - Python regular expressions with more than 100 groups?

python - Accessing the class that owns a decorated method from the decorator

How can I execute Python code without Komodo -ide?

camelcasing - Why True/False is capitalized in Python?

Can a python script persistently change a Windows environment variable? (elegantly)

python - How to send multiple input field values with same name?

python - why doesn't subprocess.Popen(...) always return?

How do I make environment variable changes stick in Python?

python - Dynamic data in postgresql

Both Python 2 and 3 in Emacs

Strip HTML from strings in Python

linux - Python and os.chroot

multithreading - python console intrupt? and cross platform threads

python - ZipFile complains, is there a way around using the zipfile module?

Best practice for two way hashing in python?

compilation - python PIL install on shared hosting

parsing - How does one parse simple inline markup (i.e. *bold*), in Python?

packaging - How to distribute `.desktop` files and icons for a Python package in Gnome (with distutils or setuptools)?

python - How to add custom fields to InlineFormsets?

What's the idiomatic Python equivalent to Django's 'regroup' template tag?

string - How to work with unicode in Python

python - Django: ModelMultipleChoiceField doesn't select initial choices

How can you use Python in Vim?

virtualbox - Python module for VBox?

python - Why aren't signals simply called events?

python - Getting the name of the active window

Problem in understanding Python list comprehensions

Alter all values in a Python list of lists?

syntax - "Slicing" in Python Expressions documentation

How to convert XML to JSON in Python

arrays - Python loops with multiple lists?

Unable to install python-setuptools: ./configure: No such file or directory

Is there a standard way to list names of Python modules in a package?

python - Easy_install of wxpython has "setup script" error

python - Practical examples of NLTK use

Further Processing of Output of Undefined Methods (Python)

python - django- run a script from admin

python - "EOL while scanning single-quoted string"? (backslash in string)

python - Can I compile numpy & scipy as eggs for free on Windows32?

utf 8 - How can I get interactive Python to avoid using readline while allowing utf-8 input?

pagination with the python cmd module

python - Monitoring user idle time

python - Is it safe to rely on condition evaluation order in if statements?

python - Inventory Control Across Multiple Servers .. Ideas?

python - Using Django admin look and feel in my own application

python - Django form fails validation on a unique field

ide - Has anyone successfully configured NetBeans for Python (specifically Python 3.0) development?

How to convert a list of number to html in Python?

Python port binding

XMP image tagging and Python

python - Transferring object through Pyro

datetime - Python time to age, part 2: timezones

python - Most suitable language(s) for simulations in modeling?

ibm midrange - Has anyone here tried using the iSeries Python port?

python - Why am I getting an invalid syntax easy_install error?

list named with a function argument in python

python - pycurl cancel a transfer and try & except

python - How do I simulate flip of biased coin?

python - pyqt import problem

user interface - What library is best for GUI in python?

python - Split list into smaller lists (split in half)

mysql - Has anyone installed MySQLdb for Python on Cygwin?

algorithm - Probability distribution in Python

python - How can I customize the output from pygments?

sql - Python + SQLite query to find entries that sit in a specified time slot

is there COMMIT analog in python for writing into a file?

Suggestions for Python debugging tools?

java - Event handling with Jython & Swing

multithreading - Client Server programming in python?

python - both a top and a bottom axis in pylab (e.g. w/ different units) (or left and right)

dependencies - Resolving dependency in python between modules

python - How do I make a Django ModelForm menu item selected by default?

python - What will I lose or gain from switching database APIs? (from pywin32 and pysqlite to QSql)

python - Generating and submitting a dynamic number of objects in a form with Django

Parse shell file output with Python

python - Search Files& Dirs on Website

python - Using web.py as non blocking http-server

python - Django email

python - Upgraded to ubuntu 9.04 django test are now slow

python - Reducing Django Memory Usage. Low hanging fruit?

python - can a method call be chained to the 'set()' built-in? (and why not?)

Where is Python used? I read about it a lot on Reddit

python - Twill/Mechanize access to html content

regex - Python parsing

animation - How do I track an animated object in Python?

Accept Cookies in Python

Python import coding style

django - Python "property object has no attribute" Exception

What should I be aware of when moving from asp.net to python for web development?

dispatcher python

documentation - How do I specify input and output data types in python comments?

email - Integrate postfix mail into my (python)webapp

regex - What's the cleanest way to extract URLs from a string using Python?

python - How to deploy Django with Spawning

python - wx's idle and UI update events in PyQt

python - Is it bad form to call a classmethod as a method from an instance?

How to read Unicode input and compare Unicode strings in Python?

python - Why does this pyd file not import on some computers?

python - How do Django model fields work?

python - pycurl request exist in header function?

python - Preserving last new line when reading a file

python - django login middleware not working as expected

user interface - Cross-platform gui toolkit for deploying Python applications

python - How do I use the wx.lib.docview package?

Short (and useful) python snippets

python - Embedding icon in .exe with py2exe, visible in Vista?

Binary array in python

Splitting a large XML file in Python

python - How do you add event to Trac event time line

constructor - How does Python's "super" do the right thing?

python - classmethod for Tkinter-Monitor-Window

string - Is there a method in python that's like os.path.split for other delimiters?

python - Good Sound processing/Analysis/Capturing Modules

file io - Python truncate lines as they are read

Python string join performance

python - Django Override form

python - How can I check the memory usage of objects in iPython?

c# - Efficient way of Solving Cryptarithms

Why can't I directly add attributes to any python object?

Is there a HAML implementation for use with Python and Django

python - pycurl and unescape

python - Get foreign key without requesting the whole object

python - Auto __repr__ method

Common ways to connect to odbc from python on windows?

python - pythonic replacement for enums

python - Is there any pywin32 odbc connector documentation available?

How can I use Perl libraries from Python?

python - Retrieving the latitude/longitude from Google Map Mobile 3.0's MyLocation feature

python - What's the fastest way to test the validity of a large number of well-formed URLs

python - Getting OperationalError: FATAL: sorry, too many clients already using psycopg2

python coding speed and cleanest

python - What is the most Pythonic way to provide a fall-back value in an assignment?

python - How can I insert RTF into a wxpython RichTextCtrl?

python - Retrieving/Printing execution context

Getting return values from a MySQL stored procedure in Python, using MySQLdb

python - List/Arrays - Check Dates

Best Resource for mysql + python 2.6 programming

security - Is there an alternative to rexec for Python sandboxing?

Easy way to check that a variable is defined in python?

python - delete *.pyc continuation

python - How can I manipulate lists?

php - Django or CodeIgniter for Turn-Key Web Application

python - How to implement a "back" link on Django Templates?

python - For my app, how many threads would be optimal?

python - Riddle: The Square Puzzle

Python Imaging Library save function syntax

Emacs - tab-completion of local Python variables

python - How to work with unsaved many-to-many relations in django?

python - Log all errors to console or file on Django site

python - I want to load all of the unit-tests in a tree, can it be done?

Time taken by an import in Python

python - Django: Permalinks for Admin

Is arr.__len__() the preferred way to get the length of an array in Python?

python - Estimating zip size/creation time

python - NumPy, PIL adding an image

What's a standard way to do a no-op in python?

python upload - where are tmp/FILES?

list - find missing numeric from ALPHANUMERIC - Python

import - Current working directory no longer inherited from calling process from python 2.5 onwards?

python - wxPython - Redrawing Error when replacing wxFrame's Panel

matplotlib - How to visualize IP addresses as they change in python?

python - Is it possible to Access a Users Sent Email over POP?

php - Python's equivalent of $this->$varName

ruby - Blocks of code in Python

django - Is it ever polite to put code in a python configuration file?

Detect file handle leaks in python?

multithreading - Python, SQLite and threading

How to get the python.exe location programmatically?

python - nice html reports for pyunit

django - Execute a string as a command in python

Why isn't keyword DateField.input_formats recognized in django 1.0.2 and Python 2.5?

python MySQL module class file name

python, how to tell what type of obj was returned

php - How to prevent every malicious file upload on my server? (check file type)?

c# - Import python functions into a .NET language?

python - Attributes not available when overwriting __init__?

python - What is the format in which Django passwords are stored in the database?

python - Changing timezone on an existing Django project

python - Should I check the types of constructor arguments (and at other places too)?

Checking a Python module version at runtime

How to convert an integer to the shortest url-safe string in Python?

Building Python PIL for JPEG looks okay, but fails the selftest

Python: How to estimate / calculate memory footprint of data structures?

python - PyQt4 and QtWebKit - how to auto scroll the view?

python - Programmatically taking screenshots in windows without the application noticing

python - Implementing chat in an application?

python - Store last created model's row in memory

Python XML - build flat record from dynamic nested "node" elements

python - Some internals of Django auth middleware

Python 3.0 Windows/COM

python - Getting 401 on Twitter OAuth POST requests

user interface - Where can I find a GUI designer for Python?

Solution basis of underdetermined equation set in python

python - case-insensitive alphabetical sorting of nested lists

python - How to write meaningful docstrings?

deployment - Why won't you switch to Python 3.x?

python - Django: using <select multiple> and POST

php - How to Make sure the code is still working after refactoring ( Dynamic language)

python - How do i extract my required data from HTML file?

python - 'for' loop through form fields and excluding one of the fields with 'if'

Digital Image cropping in Python

Reading and Grouping a List of Data in Python

Python regex split a string by one of two delimiters

python - mod_wsgi force reload modules

python - How do you construct an array suitable for numpy sorting?

python - Prevent wxPython from showing 'Unhandled exception' dialog

Python Collections.DefaultDict Sort + Output Top X Custom Class Object

Python Table engine binding for Tokyo Cabinet

python - How do I make a command line text editor?

Backslashes being added into my cookie in Python

Conditional compilation in Python

python - Best way to create a NumPy array from a dictionary?

python - Django - queries made repeat/inefficient

How do I make this python command line an alias in bash?

Python server side AJAX library?

Is there a better Python bundle for textmate than the one in the bundle repository?

python - Poplib not working correctly?

licensing - Including Python standard libraries in your distribution

winapi - Shared folder sessions in Python

python - Should I use GeoDjango for mapping a floor plan?

datetime - Python speed testing - Time Difference - milliseconds

python code convention using pylint

python - Looking for a self-contained equation rendering library

python - How to get upper paths from a single path?

logging - Need a better way to execute console commands from python and log the results

macos - Recommendations for Python development on a Mac?

Import an existing python project to XCode

python - Understanding string reversal via slicing

Python Popen, closing streams and multiple processes

email - How do I validate the MX record for a domain in python?

image - What's a more elegant rephrasing of this cropping algorithm? (in Python)

python - Amazon S3 permissions

python - Issues with BeautifulSoup parsing

python - How to display data using openlayers with OpenStreetMap in geodjango?

Python game programming: is my IO object a legitimate candidate for being a global variable?

printing - What is the best way to toggle python prints?

python - Convert timedelta to years?

python - Save and run at the same time in Vim

Check whether a PDF-File is valid with Python

How to set up Python for .NET with Python 2.6.1?

recursion - Iterative version of Python's deepcopy

python - How to tell the difference between an iterator and an iterable?

exception handling - how to time-out gracefully while downloading with python

python - Eclipse PyDev: setting breakpoints in site-packages source

django - Testing time sensitive applications in Python

python - How do I do a not equal in Django queryset filtering?

Why do languages like Java use hierarchical package names, while Python does not?

python - How to use PIL to make all white pixels transparent?

macos - Upgrading Python on OS X 10.4.11

.net - Making a 2-player web-based textual game

Issue with PyAMF, Django, and Python's "property" feature

python - BOO Vs IronPython

python - Detect script start up from command prompt or "double click" on Windows

No path in sys.path with Python and tcsh

Is there a function in Python to list the attributes and methods of a particular object?

python - Why does Google Search return HTTP Error 403?

Exif manipulation library for python

How Much Traffic Can Shared Web Hosting (for a Python Django site) support?

How to get the root node of an xml file in Python?

ide - What features would a *perfect* Python debugger have?

What is wrong with my nested loops in Python?

python - SQLAlchemy - INSERT OR REPLACE equivalent

python - Is it possible to remove recursion from this function?

Python comments: # vs. strings

http - Proxy Check in python

python - Django labels and translations - Model Design

Bayesian spam filtering library for Python

Python SAX parser says XML file is not well-formed

Python error when using urllib.open

multithreading - How's Python Multiprocessing Implemented on Windows?

Debugging a running python process

python - pygame is screwing up ctypes

python - How to detect errors from compileall.compile_dir?

path - mkdir -p functionality in Python

Should I learn Python after C++?

python - Standard Django way for letting users edit rich content

String separation in required format, Pythonic way? (with or w/o Regex)

sql - Python, Convert 9 tuple UTC date to MySQL datetime format

Which Python Bayesian text classification modules are similar to dbacl?

python - choosing between Modules and Classes

fractals - Drawing a Dragons curve in Python

Python: Why can't I modify the current scope within a function using locals()?

python - Big images with cairo

how to send mail in python ssmtp vs smtplib

.net - Embed Python script

python - web.py: passing initialization / global variables to handler classes?

python - SQLite Performance Benchmark -- why is :memory: so slow...only 1.5X as fast as disk?

email - Want procmail to run a custom python script, everytime a new mail shows up

python - Tool/library for calculating intervals like "last thursday of the month"

python - How to remove the left part of a string?

How to compare type of an object in Python?

Is there any use for Flex + Python/Ruby without a web framework (Django/Rails)?

emacs - How do I suppress python-mode's output buffer?

Python Macros: Use Cases?

python - How do I use easy_install and buildout when pypi is down?

Writing binary data to a socket (or file) with Python

regex - How do i write a regular expression for the following pattern in python?

A list of string replacements in Python

python - PyS60: Bluetooth sockets

python - Django - having middleware communicate with views/templates

user interface - questions re: current state of GUI programming with Python

python - How do I modify sys.path from .htaccess to allow mod_python to see Django?

regex - Why is the regular expression returning an error in python?

unicode - Python string prints as [u'String']

URL tree walker in Python?

How do I tell a file from directory in Python?

python - Why does setuptools sometimes delete and then re-install the exact same egg?

python - Why doesn't the weakref work on this bound method?

python - Make pyunit show output for every assertion

Dictionary to lowercase in Python

python - Adding twisted code to a pygtk app

mysql - mysqldb on python 2.6+ (win32)

object - Converting a database-driven (non-OO) python script into a non-database driven, OO-script

python - Create a standalone windows exe which does not require pythonXX.dll

python - Pythonic ways to use 'else' in a for loop

python - How to pass information using an HTTP redirect (in Django)

python - Discovering public IP programmatically

installation - How to compile Python 1.0

python - How to re-use a reusable app in Django

perl - Is there a need for a "use strict" Python compiler?

json - Authentication Required - Problems Establishing AIM OSCAR Session using Python

unix - Python source header comment

python - Which Version of TurboGears should I use for a new project?

python - How does Vista Recycle bin work?

apache - mod_wsgi/python sys.path.exend problems

Determine if a function is available in a Python module

python - Decorators and in class

What's the best technology for connecting from linux to MS SQL Server using python? ODBC?

graphing - Quick and dirty stripchart in python?

Difference between class (Python) and struct (C)

python, "a in b" keyword, how about multiple a's?

excel 2007 - Where should I post my python code?

python - Connection refused on Windows XP network

python - How to get distinct Django apps on same subdomain to share session cookie?

Is there a Perl equivalent to Python's `if __name__ == '__main__'`?

python - How do I store a string with a `"` in it?

Why do I get wrong results for hmac in Python but not Perl?

Working with MySQL booleans in python

python - Priority issue in Sitemaps

python - WingIDE no autocompletion for my modules

cygwin - Python one-liner to print every file in the current directory

How to call an external program in python and retrieve the output and return code?

string - Python HTML removal

templates - Best Python templating library to facilitate code generation

Python list serialization - fastest method

python - How to match a text node then follow parent nodes using XPath

What is the best way to pass a method (with parameters) to another method in python

Python Beginner: How to Prevent 'finally' from executing?

python - How to interact through vim?

How do you safely and efficiently get the row id after an insert with mysql using MySQLdb in python?

python - Code samples for Django + SWFUpload?

authentication - Python code to find if x is following y on twitter. More Pythonic way please

External classes in Python

python - Where is the function get_example_data in matplotlib? It seems to be missing but its in examples/tutorials

python - ImportError: No module named copy_reg pickle

introspection - Problem using super(python 2.5.2)

Can you define aliases for imported modules in Python?

python - Auto GET to argument of view

perl - Character Translation using Python (like the tr command)

python - ctypes bindings for Subversion in windows

xml - Python: Using minidom to search for nodes with a certain text

python - Can you give a Django app a verbose name for use throughout the admin?

python - How to handle unicode of an unknown encoding in Django?

python - Can compiled bytecode files (.pyc) get generated in different directory?

python - How do i convert WMD markdown syntax to HTML on my site?

python - What SHOULDN'T Django's admin interface be used for?

python - Complex Beautiful Soup query

python - What's the best way to propagate information from my wx.Process back to my main thread?

python - SQLAlchemy/Elixir validation rules?

python - Django Model Inheritance. Hiding or removing fields

python - WSGI Authentication: Homegrown, Authkit, OpenID...?

python - Getting a list of all modules in the current package

python - Calling function defined in exe

What is a good strategy for constructing a directed graph for a game map (in Python)?

python - Django admin style application for Java

python - Defining a table with sqlalchemy with a mysql unix timestamp

How do I determine if an object has an attribute in Python?

python - Where can I find examples of bsddb in use?

python - When is it (not) appropriate to bundle dependencies with an application?

html - Python Regexp problem

python - Import XML into SQL database

performance - Cheap exception handling in Python?

python - Is there something like CherryPy or Cerise in the Java world?

c# - Django or Ruby on Rails

Python 2.6 JSON decoding performance

Catching Python exceptions using 'expect' method?

python - Caching data from other websites in Django

python - Yahoo Pipes, simplejson and slashes

Python/Django plugin for Dreamweaver

python - skip over HTML tags in Regular Expression patterns

How to use boolean 'and' in Python

python - How do you send an Ethernet frame with a corrupt FCS?

javascript - HTML Rich Textbox

iterator - any way to loop iteration with same item in python?

python - Controlling a Windows Console App w/ stdin pipe

What encoding do I need to display a GBP sign (pound sign) using python on cygwin in Windows XP?

python - How can i use TurboMail 3 together with TurboGears 2

python - Inserting object with ManyToMany in Django

python - Django Model: Returning username from currently logged in user

python - Charts in django Web Applications

python - Using paver and nose together with an atypical directory structure

unit testing - Python: How to run unittest.main() for all source files in a subdirectory?

python - indentation of multiline string

Python HTTP server that supports chunked encoding?

python - Monitoring contents of files/directories?

python - Matplotlib's GUI doesn't allow typing in save box?

How do I create a windows service with Python

A simple Python IRC client library that supports SSL?

python - Get Tk winfo_rgb() without having a window instantiated

python - Converting from mod_python to mod_wsgi

Problems title-casing a string in Python

python - pythonic way to compare compound classes?

python - Add event to list

pinging mysql using mysql alchemy and python

Concurrency: Are Python extensions written in C/C++ affected by the Global Interpreter Lock?

python - Serving static files with mod_wsgi and Django

python - How do you make a case for Django [or Ruby on Rails] to non-technical clients

python - <class> has no foreign key to <class> in Django when trying to inline models

java - Why Jython behaves inconsistently when tested with PyStone?

python - Multiprocessing or Multithreading?

How to concisely cascade through multiple regex statements in Python

chmod - check permissions of directories in python

python - pysqlite user types in select statement

Linking to Python import library in Visual Studio 2005

python - cx_oracle and oracle 7?

python - How do I check if it's the homepage in a Plone website using ZPT?

Env Variables in Python (v3.0) on Windows

dictionary - How do I re-map python dict keys

mouse - How to create MS Paint clone with Python and pygame

Is it possible, with the Python Standard Library (say version 2.5) to perform MS-SQL queries which are parameterized?

python - HTML Newbie Question: Colored Background for Characters in Django HttpResponse

python - PY: Url Encode without variable name

import - Importing in Python between three or more files not working

python - Best way to turn word list into frequency dict

How does Python sort a list of tuples?

c++ - How would you implement a basic event-loop?

python - How can I stop IDLE from printing giant lists?

regex - How do you substitue a Python capture followed by a number character?

c# - FOSS HTML to PDF in Python, .Net or command line?

python - Showing data in a GUI where the data comes from an outside source

Python class inclusion wrong behaviour

python - help with complex join in Django ORM

Python, redirecting the stream of Popen to a python function

Is there a way to get all the directories but not files in a directory in Python?

amazon s3 - Python: efficiently join chunks of bytes into one big chunk?

python - How do I find the modules that are available for import from within a package?

python - Is there anything that cannot appear inside parentheses?

Good examples of python-memcache (memcached) being used in Python?

python - Why doesn't the handle_read method get called with asyncore?

django - Does anyone know about workflow frameworks/libraries in Python?

python - Rotation based on end points

python - Django GROUP BY strftime date format





top