I have a big libray written in C++ and someone created an interface to use it in python (2.6) in an automatic way. Now I have a lot of classes with getter and setter methods. Really: I hate them.
I want to reimplement the classes with a more pythonic interface using properties. The problem is that every class has hundreds of getters and...
I have a snippet of HTML that contains paragraphs. (I mean p tags.) I want to split the string into the different paragraphs. For instance:
'''
<p class="my_class">Hello!</p>
<p>What's up?</p>
<p style="whatever: whatever;">Goodbye!</p>
'''
Should become:
['<p class="my_class">Hello!</p>',
'<p>What's up?</p>'
'<p style="whatever: w...
I'm looking for a good (and, if possible, simple) open-source Python library to do neural network computations. It should be able to deal with multiple-layer networks and backpropagation learning. Speed of implementation does not really matter for me. Does anyone have suggestion on what I can use?
Thanks
...
I'm currently trying to expose a c++ Interface (pure virtual class) to Python using Boost::Python. The c++ interface is:
Agent.hpp
#include "Tab.hpp"
class Agent
{
virtual void start(const Tab& t) = 0;
virtual void stop() = 0;
};
And, by reading the "official" tutorial, I managed to write and build the next Python wrapper:
A...
hi i am trying to get the extension of the file called in a url (eg"/wp-includes/js/jquery/jquery.js?ver=1.3.2 HTTP/1.1") and get the query perimeters passed to the file too what would be the best way to the extension?
...
from Tkinter import *
import socket, sys, os
import tkMessageBox
root = Tk()
root.title("File Deleter v1.0")
root.config(bg='black')
root.resizable(0, 0)
text = Text()
text3 = Text()
frame = Frame(root)
frame.config(bg="black")
frame.pack(pady=10, padx=5)
frame1 = Frame(root)
frame1.config(bg="black")
frame1.pack(pady=10, padx=5)
t...
GIven this:
It%27s%20me%21
Unencode it and turn it into regular text?
...
What is the pythonic way to split a string before the occurrences of a given set of characters?
For example, I want to split
'TheLongAndWindingRoad'
at any occurrence of an uppercase letter (possibly except the first), and obtain
['The', 'Long', 'And', 'Winding', 'Road'].
Edit: It should also split single occurrences, i.e.
from 'ABC'...
Now the obvious answer is to just open the script from a command line, but that isn't an option. I'm writing a simple application to syntax highlight Python and then run the scripts from the same program. A Python IDE if you will. The scripts I want to run are entirely command line programs.
I'm using a System.Diagnostics.Process obj...
Hey everyone,
Sorry for the very general title but I'll try to be as specific as possible.
I am working on a text mining application. I have a large number of key value pairs of the form ((word, corpus) -> occurence_count) (everything is an integer) which I am storing in multiple python dictionaries (tuple->int). These values are sprea...
I'm using mr.developer to track some packages on github. When I rerun my buildout, I get:
The package 'django-quoteme' is dirty.
Do you want to update it anyway? [yes/No/all] y
What is meant by "dirty" exactly?
...
I need to run some code on a Linux machine with Python 2.3.4
pre-installed. I'm not on the sudoers list for that machine, so I
built Python 2.6.4 into (a subdirectory in) my home directory. Then I
attempted to use virtualenv (for the first time), but got:
$ Python-2.6.4/python virtualenv/virtualenv.py ENV
New python executable in ENV/...
Hi I'm writing a psudo-terminal that can live in a tty and spawn a second tty which is filters input and output from
I'm writing it in python for now, spawning the second tty and reading and writing is easy
but when I read, the read does not end, it waits for more input.
import subprocess
pfd = subprocess.Popen(['/bin/sh'], shell=Tru...
I was thinking of trying OpenCV for a project and noticed that it had C, C++ and Python.
I am trying to figure out whether I should use C++, C or Python -- and would like to use whatever has the best OpenCV support.
Just from looking at the index page for the various documentation it looks like the C++ bindings might have more featur...
When creating a UUID in Python, likeso:
>>> uuid.uuid1()
UUID('a8098c1a-f86e-11da-bd1a-00112444be1e')
How could one map that UUID into a string made up of the capitalized alphabet A-Z minus the characters D, F, I, O, Q, and U, plus the numerical digits, plus the characters "+" and "=". i.e. the from an integer or string onto the set o...
I'm a noob but I made my application work beautifully using python manage.py runserver but when I brought it to Apache + mod_wsgi, I keep getting this error. The debug messages aren't much help. Here is a screenshot of the entire debug image: http://img694.imageshack.us/img694/6723/screenshotfb.png
Here is the dump of my http.conf file....
Consider the following Python (runs in 2.x or 3.x):
class Outer(object):
pass
class Inner(object):
def __init__(self):
print("Inner.self", self)
o = Outer()
i = o.Inner()
I want to get my hands on o while inside Inner.__init__(). But:
I don't want o to be an explicit parameter to Inner.
I want O.Inner and o.Inner to...
I have tried this but its not correct:
In [34]: e_now
Out[34]: datetime.datetime(2010, 2, 17, 0, 2, 40, 506444, tzinfo=<DstTzInfo 'US/Eastern' EST-1 day, 19:00:00 STD>)
In [35]: e_now.utcoffset()
Out[35]: datetime.timedelta(-1, 68400)
...
Basicaly I have a user inputted string like:
"hi my name is bob"
what I would like to do is have my program randomly pick a new ending of the string and end it with my specified ending.
For example:
"hi my name DUR."
"hi mDUR."
etc etc
I'm kinda new to python so hopefully there's an easy solution to this hehe
...
I am using a custom cache backend to wrap the built-in cache backends so that I can add the current site_id to all the cache_keys (this is useful for multi-site functionality with a single memcached instance)
unfortunately it works great on the django built-in devserver, but give a nasty error when I try to run it on the live server wit...