Python - Get HTML with DOM

I have a flash card making program for Spanish that pulls information from here: http://www.spanishdict.com/examples/zorro (this is just an example). I've set it up so it gets the translations fine, but now I want to add examples. I noticed however,

(PYTHON) while the aid to the 2.7 declaration

I've mostly been using Python 3.2 but moving on to 2.7 just for visual base purposes. I can't seem to make my loop form an endless cycle, say if the user enters the incorrect phrase, the code just breaks after inputting the wrong variable. measure =

Best way to multiprocess on a large Python file

I have a python script that would traverse a list(>1000 elements), find the variable in a large file and then output the result. I am reading the entire file >1000 times. I tried using multiprocessing, but not of much help. Here's what I am trying t

Python Tkinter secure to self.quit or sys.exit?

In the spirit of decoupling, rather than cramming many widgets into one giant class, I tried splitting them into separate classes. The problem I ran into is the FileMenu class does not know about root, and so cannot call root.quit or root.destroy. On

Get the file syntax selection in sublime text 3 plugin

I have a very small plugin to open a perl file module starting from the use statement. It's really basic and it just replaces '::' with '/' and then if the file exists in one of the paths specified in PERL5LIB, it opens it. I want it to run only when

Extract html data using regular expressions

I have an html page that looks like this <tr> <td align=left> <a href="history/2c0b65635b3ac68a4d53b89521216d26.html"> <img src="/images/page.gif" border="0" title="полная информация о документе"

Access Ajax data in python

I am newbie in python and am using Python to get the request from AJAX calls but I am getting the code of python as it is inside the AJAX output which I don't want. AJAX Code : $.ajax({ type: "POST", url: "hello.py", datatype : "j

Check between floats in a list that a given float falls

I have a list that looks like this: # Ordered list. a = [0.1, 0.3, 0.4, 0.5, 0.6, 0.7, 0.9] I need to iterate through a list of floats that looks like this: # Not ordered list. b = [0.12, 0.53, 0.30, 0.03, 0.77, 0.62, 0.98, 0.01, 0.42, 0.33, 1.3] che

Regex to match a string with only 2 capital letters

I want to write a regex which will match a string only if the string consists of two capital letters. I tried - [A-Z]{2}, [A-Z]{2, 2} and [A-Z][A-Z] but these only match the string 'CAS' while I am looking to match only if the string is two capital l

Implementation of GARCH on Python for index hedging

I am trying to use GARCH(1,1) to find the hedge ratio as described in this paper http://search.livjm.ac.uk/AFE/AFE_docs/cibef0402.pdf. However, Python does not offer packages for GARCH(1,1), thus I think I have to implement it myself. The data I have

Pandas merge on the name and the nearest date

I am trying to merge two dataframes on both name and the closest date (WRT the left hand dataframe). In my research I found one similar question here but it doesn't account for the name as well. From the above question it doesn't seem like there is a

Python top Dictionary program and the list problem

Write a program that reads the contents of a random text file. The program should create a dictionary in which the keys are individual words found in the file and the values are the number of times each word appears. How would I go about doing this?

Use a list to search in a text file - Python

I'm new to Python, but I'm convinced that you should learn by doing. So here goes: I'm trying to create a small CLI-application that takes two textfiles as input. It's then supposed to create a list of common SSIDs from the file SSID.txt, and then go

Unexpected python file behavior

Possible Duplicate: Weird behavior when writing and reading file When I try to write into a file and then read it, I get an unexpected result. My code is: f=open("z.txt","w+") f.write("Hello") content=f.read() print content f

Deploying on the PROD personal domain using GAE

I deployed Hello world to http://rajinination.appspot.com/ using GAE successfully. When I linked it to personal domain http://rajinination.com/ it shows a "Error 404". I linked my personal domain to appspotdomain: imgur.com/t8jKJ Error 404 : img

How to start PyCharm using port 80

I can't run my PyCharm IDE using port 80. I need to use PayPal that requires me to use port 80. But using Mac OS X 10.8 I can't have it working because of permission issues. I've already tried running PyCharm with SUDO command. Does anyone know how t

Python converts Tuple to Integer

Is there any function that can convert a tuple into an integer? Example: input = (1, 3, 7) output = 137 >>> reduce(lambda rst, d: rst * 10 + d, (1, 2, 3)) 123

Lift Http404 in the URL template

I'm trying to override a url in django-profiles to raise a 404 instead of passing to the view. I'm looking for something along the lines of: url(r'^profiles/$', lamdba x: raise Http404) But the above doesn't work. Is this sort of thing possible? I kn

Non-consuming regular expression divided into Python

How can a string be split on a separator expression while leaving that separator on the preceding string? >>> text = "This is an example. Is it made up of more than once sentence? Yes, it is." >>> re.split("[\.\?!] ",

PyQt & amp; unittest - signal and slot test

I have a pyqt application that I'm writing unit tests for, and it relies heavily on signals and slots. To properly test it, I have to check that the correct signals are sent. What is the best way to do this? I see that the Qt library has a QSignalSpy