Questions for python


Python regex: Fix one html close tag

<div>random contents without < or > , but has ( ) <div>

Django infer a field from other fields

I am currently having a model:

How to add oauth2 package to Eclipse pydev?

I'm attempting to install the oauth2 package from

Kivy: Sound starts to play, but is 'unstoppable' on Android, but on Windows it works

I got a series of ToggleButtons in kivy, with each loaded a different soundfile.

how to show mime data using python cgi in windows+apache

I met a problem while using python(2.6) cgi to show a mime data in windows(apache).

Cron Jobs, Task Queue or Deferred Tasks?

In Google App Engine, for a task like scanning some RSS feeds and adding new entries from the feed to the datastore every 10-15 seconds, should I use Cron Jobs, Task Queue or Deferred Tasks? I'm re...

Map/Iterating through List of Python Object

Is there a way to iterate and call a function on a list of user-defined Python objects with multiple attributes? Let's suppose it's called Entry, with attribute name, and age.

Match alphanumeric string in nltk grammar

I'm trying to use NTLK grammar and parse algorithms as they seem pretty simple to use. Though, I can't find a way to match an alphanumeric string properly, something like:

R as a general purpose programming language

I liked Python before because Python has rich built-in types like sets, dicts, lists, tuples. These structures help write short scripts to process data.

Where is the Python startup banner defined?

I'm compiling several different versions of Python for my system, and I'd like to know where in the source the startup banner is defined so I can change it for each version. For example, when the

Get source code from App Engine

Is it possible to download copies of our application's code from the Google App Engine servers?

Why was an old .pyc file breaking Django?

I pulled the latest code using git today and I got the following error:

Removing control characters from a string in python

I currently have the following code

How to use Images Python API correctly to display an avatar with user comments?

This is a follow up question to my previous question. I am trying to upload and display an image as an avatar following the sample app here.

Python shared libraries - Cheetah not found

I'm using Python Cheetah for template generation and I can't get it to use the compiled library that is installed. I am running on CentOS 5.4 with Python 2.4 installed, using Cheetah

Iterating through a scipy.sparse vector (or matrix)

I'm wondering what the best way is to iterate nonzero entries of sparse matrices with scipy.sparse. For example, if I do the following:

Why give a local variable an initial value immediately before assigning to it?

While looking at the source code of the asyncore module I came across this method. I'll include it here without context, as it seems to be quite self contained:

Django XMMS2: 'module' object has no attribute 'XMMS'

I just started to use Python so the following might be a really REALLY dumb question but I searched the web for a long time and didn't find anything.

Regex Help, por favor

So I have a text file with comma separated numbers, I'm trying to write Python to get me the numbers three at a time - they're 3D co-ordinates and I want to analyse them 3 at a time.

split twice in the same expression?

Imagine I have the following:

telnet from linux pc to windows pc using python script

i am trying to telnet a windows pc from linux using python script(pexpect).when i try to connect this error pop's up The operation completed successfully...Login Failed below is my python script.

In Python's PIL, how do I change the quality of an image?

I want to degrade the quality of the image to a few kilobytes.

how to get the value from django model?

I have a problem in getting the value in my django...

Passing a dictionary to a function in python as keyword parameters

I'd like to call a function in python using a dictionary.

Python optparse metavar

I am not sure what optparse's metavar parameter is used for. I see it is used all around, but I can't see its use.

Project Euler #3, infinite loop on factorization

So I'm doing Project Euler because dear gods do I need to practice writing code, and also my math skills are rusty as something very rusty. Thusly; Project Euler. I'm sure most here have already se...

Whats the difference between Python decorators and Decorator Pattern?

Whats the difference between “Python decorators” and the “decorator pattern”?

How to Clean Up subprocess.Popen Instances Upon Process Termination

I have a JavaScript application running on a Python / PyQt / QtWebKit foundation which creates subprocess.Popen objects to run external processes.

unescaping xml text from ElementTree in python

I'm trying to pull out an escape noded from an XML document. The raw text for the node looks like this:

Does app engine have a Deploy Hook or Event?

I want to increase the version number on a model whenever there is a new deployment to the server.

What does “None” mode mean in Image.fromarray?

I am converting from a numpy array to an image using the

Searching for books with the Amazon Product Advertising API - Python

tl;dr : I am using the Amazon Product Advertising API with Python. How can I do a keyword search for a book and get XML results that contain TITLE, ISBN, and PRICE for each entry?

Python and C++ code comparison

I have the following python code

How can I auto run py.test once a relative command has been change?

Via autonose or nosy, it will automatically run the nosetests once the some tests file or the relative files have been changes. I would like to ask that whether py.test provides the similar functio...

Give the Python Terminal a Persistent History

Is there a way to tell the interactive Python shell to preserve its history of executed commands between sessions?

Asynchronous file writing possible in python?

Is there an existing module or an easy way to use aio_write to write to a file asynchronously in python? I know by file io that comes with Python is all blocking which is fine in most cases, but fo...

MySQL Query error when run within Python but not when run directly

I am passing '2012-09-10 00:00:00-05:00' to a MySQL query. This value is retrieved using the pytz module for Python.

array initialized to “None” in Python

I see a piece of python code

Why is it ill advised to use pyramid.threadlocal.get_current_request?

My assumption is that the correct request object is not the guaranteed result, but I would like to know exactly why it's ill advised, and the recommended way is to pass the request object down the

django-mptt tree rebuild error

I used django-mptt version (0,5,'+dev')

How do I get my output in column format?

I'm very new to Python and have a question. Currently I'm using this to calculate the times between a message goes out and the message comes in. The resulting starting time, time delta, and the Uni...

Networkx graph: finding if path exists between any node in a given set of nodes and another set of nodes

I have a large undirected graph with hundreds of thousands of nodes and tens of thousands of edges. I have two separate problems:

How to display an image from blobstore?

I am trying to understand the documentation Using the Images Python API and I am confused about how to get the key and display the avatar.

Retrieve data/exception from a handler function

I'm trying to use Python and pywinusb-0.3.2 to read data from a USB weighing scale when a valid request hits the web server (requested_serial_number is coming from the query string).

how to scale Quiver diagrams correctly

I'm trying to find a solution to the following problem:

How to send a subprocess to the background & without using shell=True

I'm trying to write a part of a Python script what changes the root MySQL password under Linux for a small web-admin interface. I've followed the official MySQL documentation on changing the root

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.