Questions for python


7778

Python regex: Fix one html close tag

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

Django infer a field from other fields

I am currently having a model:
3176

How to add oauth2 package to Eclipse pydev?

I'm attempting to install the oauth2 package from https://pypi.python.org/pypi/oauth2/
1917

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.
9451

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).
6374

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...
5445

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.
5308

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:
1947

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.
1990

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
7432

Get source code from App Engine

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

Why was an old .pyc file breaking Django?

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

Removing control characters from a string in python

I currently have the following code
7676

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.
5544

Python shared libraries - Cheetah namemapper.so not found

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

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:
6809

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:
1786

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.
9072

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.
3238

split twice in the same expression?

Imagine I have the following:
7420

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.
1811

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.
6428

how to get the datetime.date() value from django model?

I have a problem in getting the datetime.date() value in my django...
3247

Passing a dictionary to a function in python as keyword parameters

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

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.
1007

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...
5569

Whats the difference between Python decorators and Decorator Pattern?

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

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.
2092

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:
4426

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.
1685

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

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

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?
1832

Python and C++ code comparison

I have the following python code
3001

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...
4147

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?
4080

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...
6421

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.
3957

array initialized to “None” in Python

I see a piece of python code
3890

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
4539

django-mptt tree rebuild error

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

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...
350

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:
5951

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.
986

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).
3348

how to scale Quiver diagrams correctly

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

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.