I've tried to run the following code on Komodo IDE (for python):
import unittest
class MathLibraryTests(unittest.TestCase):
def test1Plus1Equals2(self):
self.assertEqual(1+1, 2)
Then, I created a new test plan, pointing to this project(file) directory and tried to run it the test plan. It seems to run but it doesn't seem ...
I have a relatively extensive sqlite database that I'd like to import into my Google App Engine python app.
I've created my models using the appengine API which are close, but not quite identical to the existing schema. I've written an import script to load the data from sqlite and create/save new appengine objects, but the appengine en...
Hey guys, i'm really trying to understand regular expressions while scraping a site, i've been using it in my code enough to pull the following, but am stuck here. I need to quickly grab this:
http://www.example.com/online/store/TitleDetail?detail&sku=123456789
from this:
('<a href="javascript:if(handleDoubleClick(this.id)){windo...
there are many ways, how to code histogram in Python.
by histogram, i mean function, counting objects in an interable, resulting in the count table (i.e. dict). e.g.:
>>> L = 'abracadabra'
>>> histogram(L)
{'a': 5, 'b': 2, 'c': 1, 'd': 1, 'r': 2}
it can be written like this:
def histogram(L):
d = {}
for x in L:
if x ...
With the recent SEC proposal requiring that most Asset-Backed Securities issuers file a python computer program to document the flow of funds (or waterfall) provisions of the transaction, I thought it timely to ask what you thought the "Must-Have" Python Packages for Finance would be.
PS: apart from answering here, please also consider ...
I have an html document, and I want to pull the tables out of this document and return them as arrays. I'm picturing 2 functions, one that finds all the html tables in a document, and a second one that turns html tables into 2-dimensional arrays.
Something like this:
htmltables = get_tables(htmldocument)
for table in htmltables:
...
I ran across something once upon a time and wondered if it was a Python "bug" or at least a misfeature. I'm curious if anyone knows of any justifications for this behavior. I thought of it just now reading "Code Like a Pythonista," which has been enjoyable so far. I'm only familiar with the 2.x line of Python.
Raw strings are strings...
Hello..
I am working on a personal project where I need to manipulate values in a database-like format.
Up until now I have been using dictionaries, tuples, and lists to store and consult those values.
I am thinking about starting to use SQL to manipulate those values, but I don't know if it's worth the effort, because I don't know an...
i use gaema for twitter user loggin http://code.google.com/p/gaema/
and my code is :
class TwitterAuth(WebappAuth, auth.TwitterMixin):
pass
class TwitterHandler(BaseHandler):
def get(self):
twitter_auth = TwitterAuth(self)
try:
if self.request.GET.get("oauth_token", None):
twitter_au...
When I try to write a field that includes whitespace in it, it gets split into multiple fields on the space. What's causing this? It's driving me insane. Thanks
data = open("file.csv", "wb")
w = csv.writer(data)
w.writerow(['word1', 'word2'])
w.writerow(['word 1', 'word2'])
data.close()
I'll get 2 fields(word1,word2) for first example...
I'm trying to compile a variety of python extensions (pycrypto, paramiko, subvertpy...) on Mac OS X 10.6, such that they will be compatible with Mac OS X 10.5 and its built-in python 2.5, for including in a product installer targetted at Mac OS X 10.5.
I'm really not sure how to go about this. I dug around on Google and found a question...
I'm looking for the most efficient way to add an element to a comma-separated string while maintaining alphabetical order for the words:
For example:
string = 'Apples, Bananas, Grapes, Oranges'
addition = 'Cherries'
result = 'Apples, Bananas, Cherries, Grapes, Oranges'
Also, a way to do this but while maintaining IDs:
string = '1:Ap...
It's a bit ugly that many lines of code fall into "__main__".
Can someone give me a tip of how to move SessionMiddleware into handle method?
I should notice that I use session in CoreXmlParser.
Thanks in advance !
def handle(environ, start_response):
req = webob.Request(environ)
c = CoreXmlParser(req)
resp = webo...
I want to write a simple python script that send a EML file exported from Outlook though given smtp server as email to a given list of emails. I know how to send a simple email but sending a EML file as email is not something i could do and could not find it on Google. Can anyone help me with that. The EML file is actually in HTML forma...
Hi,
I'm trying to get drop a file onto a Window (I've tried the same thing with a QListWidget without success there too)
test.py:
#! /usr/bin/python
# Test
from PyQt4 import QtCore, QtGui
import sys
from qt_test import Ui_MainWindow
class MyForm(QtGui.QMainWindow, Ui_MainWindow):
def __init__(self, parent=None):
QtGui.QWi...
Dear all,
Do anyone know if there are alternatives of Django-SocialAuth which support Google, Facebook, Twitter and OpenID account.
I prefer webapp version instead of Django.
Or if you have done once would you mind sharing it?
Thanks in million.
...
Hi,
I'm trying to implement a shuttle control in wxPython but there doesn't seem to be one. I've decided to use two listbox controls. The shuttle control looks like this:
I've got two listboxes — one's populated, one's not. Could someone show me how to add a selected item to the second list box when it is double clicked? It should be...
PyObject* dict = PyDict_New();
PyDict_SetItem(dict, key, value);
PyDict_GetItem(dict, key);
Bus error if i use getitem function otherwise not.
So Want to confirm that the dictionary has the same values which i have set.
Other than using PyDict_GetItem function, Is there any other method to print the values of the dictionary?
...
Hi All,
I would like to create an online dictionary application by using python (or with django).
It will be similar to http://dictionary.reference.com/.
PS: the dictionary is not stored in a database. it's stored in a text file or gunzip file. Free english dictionary files can be downloaded from this URL: dicts.info/dictionaries.php...
I have two large lists that are filled with dictionaries. I need to combine the entries if a value from dict2==dict1 and place the newly combined matches somewhere else. I'm having trouble explaining it.
List one contains:
{'keyword':value, 'keyword2':value2}
List two:
{'keyword2':value2, 'keyword3':value3}
I want a new list with ...