I am trying to build a range with an upper bound bigger than limit of integer in Python. I was looking for something like the following:
import sys
start = 100;
step = 100;
limit = sys.maxint + 1;
result = xrange(start, limit, step);
However, xrange parameters are limited to the integer. According to Python Standard Library, I have to...
I am trying to build a RESTful api with Django to share mp3s -- right up front: it's a toy app, never going into production, so it doesn't need to scale or worry (I hope) about copyright devils.
My problem now is that I have a Django view that I want to be the endpoint for HTTP PUT requests. The headers of the PUT will contain the metad...
Hi guys,
I posted this question under an alter yesterday not realising my account was still active after 9 months, sorry for the double post, i've fixed an error in my example pointed out by jellybean and i'll elaborate further on the context of the problem.
I'm trying to process a first order logic formula represented as nested lists ...
I am wondering if there is any way to get some meta information about the interpretation of a python statement during execution.
Let's assume this is a complex statement of some single statements joined with or (A, B, ... are boolean functions)
if A or B and ((C or D and E) or F) or G and H:
and I want to know which part of the state...
Hey,
It's not really scraping, I'm just trying to find the URLs in a web page where the class has a specific value. For example:
<a class="myClass" href="/url/7df028f508c4685ddf65987a0bd6f22e">
I want to get the href value. Any ideas on how to do this? Maybe regex? Could you post some example code?
I'm guessing html scraping libs, su...
This is my simple Django database model. It's for a 5-star rating system.
class Rating(models.Model):
content = models.OneToOneField(Content, primary_key=True)
ip = models.CharField(max_length=200, blank=True)
rating = models.IntegerField(default=0)
As you can see, it is linked to "Content", which is the table for my docu...
I am writing a app in python and utilzing sqlite. I have a list of strings which I would like to add too the database, where each element represents some data which coincides with the column it will be put.
currently I have something like this
cursor.execute("""insert into credit
values ('Citi','5567','visa',6000...
As in this example http://stackoverflow.com/questions/259451/how-to-extract-frequency-information-from-an-input-audio-stream-using-portaudio I'm curious about portaudio and numpy...
I'm not 100% sure about fft, how can I pass numpy a chunk and get back three values from -1.0 to 1.0 for bass, mid and treble ?
I don't mind if this just...
Would it be possible to translate the Ruby on Rails code base to Python?
I think many people like Python more than Ruby, but find Ruby on Rails features better (as a whole) than the ones in Python web frameworks.
So that, would it be possible? Or does Ruby on Rails utilize language-specific features that would be difficult to translate...
I'm trying to use ctypes to extract data from internal python structures. Namely, I'm trying to read the 4 fields in an xrange:
typedef struct {
PyObject_HEAD
long start;
long step;
long len;
} rangeobject;
Is there any standard way of getting at such fields within python itself?
...
I am trying to simulate a a network consisting of several clients and servers. I have written node.py which contains client-server code. I want to run multiple instances node.py. But I don't want to do it manually so I have written another file spawn.py which spawns multiple instances of node.py using fork and exec. However, I need to ru...
I'm trying to write a Python script that reads a series of memory locations of a particular process.
How can I do this in Python?
I'll be using Windows if it matters. I have the processes PID that I'm attempting to read/edit.
Am I going to have to revert to calling ReadProcessMemory() and using ctypes?
...
I'm thinking something along the lines of the webbrowser module, but for file browsers. In Windows I'd like to open explorer, in GNOME on Linux I want to open nautilus, Konqueror on KDE, etc. I'd prefer not to kludge it up if I can avoid it. ;-)
...
I am considering the design of an interpreter for Python like object oriented language in Haskell. One particular problem I am facing is related to the concept of object identity. If we consider Python's id(object) function, the definition suggests that it returns the "identity" of an object. This is an integer (or long integer) which is...
Is there any python code to convert outlook pst mails to eml format. Please also suggest for any such code in some other language. Thank you.
...
Is there any Python library or some sample code which demonstrates how to convert basic HTML into RML (Reportlab Markup Language www.reportlab.org)? I can think of using a regular HTML parser and adding some home grown code to generate the RML, but I guess there will be a lot of cases to handle in such a conversion.
...
how can I tell nltk to treat the text in a particular language?
BKG: once in a while i write a specialized NLP routine to do POS tagging, tokenizing etc. on a non-english (but still hindo-european) text domain.
this question seem to address only different corpora, not the change in code / settings:
http://stackoverflow.com/questions/16...
Suppose I give you a URL...can you analyze the words and spit out the "keywords" of that page?
(besides using meta-tags)
Are there good open-source summarizers out there? (preferably Python)
...
My model class looks as follows:
from google.appengine.ext import db
class SnapShotBase(db.Model):
'''
The base class from which all entity snapshots will inherit.
'''
version = db.IntegerProperty()
def __init__(self):
pass
Imagine I already have persisted instances of this class in my bigtable datastore. ...
So, here's my question:
I have a crawler that goes and downloads web pages and strips those of URLs (for future crawling). My crawler operates from a whitelist of URLs which are specified in regular expressions, so they're along the lines of:
(http://www.example.com/subdirectory/)(.*?)
...which would allow URLs that followed the patt...