How can you dynamically generate a .doc file using AJAX? Python? Adobe AIR? I'm thinking of a situation where an online program/desktop app takes in user feedback in article form (a la wiki) in Icelandic character encoding and then upon pressing a button releases a .doc file containing the user input for the webpage. Any solutions/sugges...
Previously I asked this question and got back this BeautifulSoup example code, which after some consultation locally, I decided to go with.
>>> from BeautifulSoup import BeautifulStoneSoup
>>> html = """
... <config>
... <links>
... <link name="Link1" id="1">
... <encapsulation>
... <mode>ipsec</mode>
... </encapsulation>
... </link...
What are the good resources that discuss Algorithms, P NP problems, Dynamic Programming, Special cases of those- Knapsack problems and such.
The resource must have working code, preferably in Python. Advantage if it explains some of the TopCoder SRM Dynamic Programming questions.
PS: I am a web developer interested in algorithms and an...
I'm working on code to parse a configuration file written in XML, where the XML tags are mixed case and the case is significant. Beautiful Soup appears to convert XML tags to lowercase by default, and I would like to change this behavior.
I'm not the first to ask a question on this subject [see here]. However, I did not understand the...
Hello,
Suppose this is my list of languages.
aList = ['Python','C','C++','Java']
How can i write to a file like :
Python : ...
C : ...
C++ : ...
Java : ...
I have used rjust() to achieve this. Without it how can i do ?
Here i have done manually. I want to avoid that,ie; it shuould be ordered automati...
Can anyone share some pointers on building a Donations module for Satchmo? I'm comfortable customizing Satchmo's product models etc but unable to find anything related to Donations
I realize it's possible to create a Donations virtual product but as far as I can tell this still requires setting the amount beforehand ($5, $10 etc). I wan...
I run into follow problem. Did I miss anything?
Association.all().count()
1
Association.all().fetch(1)
[Association(**{'server_url': u'server-url', 'handle': u'handle2', 'secret': 'c2VjcmV0\n', 'issued': 1242892477L, 'lifetime': 200L, 'assoc_type': u'HMAC-SHA1'})]
Association.all().filter('server_url =', 'server-url').count()
0 # exp...
buildin an smtp client in python . which can send mail , and also show that mail has been received through any mail service for example gmail !!
...
I need to capture audio clips as WAV files that I can then pass to another bit of python for processing. The problem is that I need to determine when there is audio present and then record it, stop when it goes silent and then pass that file to the processing module.
I'm thinking it should be possible with the wave module to detect when...
I have a web server with Django(Python programming language), hosted with Apache server. I would like to configure Google Appengine for the email server. My web server should be able to use Google Appengine, when it makes any email send using EmailMessage or sendmail infrastructure of Google mail api. I learnt that using remote_api I can...
Is it possible for the nose unit testing framework to perform tests during the compilation phase of a module?
In fact, I'd like to test something with the following structure:
x = 123
# [x is used here...]
def test_x():
assert (x == 123)
del x # Deleted because I don't want to clutter the module with unnecessary attributes
nosetes...
Are there any guidelines to writing Google App Engine Python code that would work without Google's infrastructure on other platforms?
Is there any known attempt to create an open source framework which can run applications designed for Google App Engine on other platforms?
Edit:
To clarify, the question really is:
If I develop an app...
Hello,
Referring to the first answer about python's bound and unbound methods here, I have a question:
class Test:
def method_one(self):
print "Called method_one"
@staticmethod
def method_two():
print "Called method_two"
@staticmethod
def method_three():
Test.method_two()
class T2(Test):
...
In shells like the interactive python shell, you can usually use the arrow keys to move around in the current line or get previous commands (with arrow-up) etc.
But after I ssh into another machine and start python there, I get sessions like:
>>> import os
>>> ^[[A
where the last character comes from arrow-up. Or, using arrow-left:
...
I have rows in file like :
20040701 0 20040701 0 1 52.965366 61.777687 57.540783
I want to put that in a dynamic array if it's possible ?
Something like
try:
clients = [
(107, "Ella", "Fitzgerald"),
(108, "Louis", "Armstrong"),
(109, "Miles", "Davis")
]
cur.executeman...
I'm about to start a new job where the coding practices are heavily centered around TDD and refactoring, and whose primary development language is Python. I come from the Java world, and have been a confident user of Eclipse for a good, long time. When not working in Java, I use emacs.
I'm looking for an IDE for Python that will give ...
Is it possible to declare more than one variable using a with statement in Python?
Something like:
from __future__ import with_statement
with open("out.txt","wt"), open("in.txt") as file_out, file_in:
for line in file_in:
file_out.write(line)
... or is cleaning up two resources at the same time the problem?
...
Given the following code:
def slope(x1, y1, x2, y2):
"""
>>> slope(5, 3, 4, 2)
1.0
>>> slope(1, 2, 3, 2)
0.0
>>> slope(1, 2, 3, 3)
0.5
>>> slope(2, 4, 1, 2)
2.0
"""
xa = float (x1)
xb = float (x2)
ya = float (y1)
yb = float (y2)
return (ya-yb)/(xa-xb)
if name_ ...
Hi, I'm a python newbie, so maybe my question is very noob.
Assume I have a list of words, and I want to find the number of times each word appears in that list.
Obvious way to do this is:
words = "apple banana apple strawberry banana lemon"
uniques = set(words.split())
freqs = [(item, words.split.count(item)) for item in uniques]
print...
This feels like it should be an easy one, but I'm having trouble cleaning out the newline character in content pasted from Microsoft Word. Not a full line-break, but the CTRL ENTER character that shows up as a return arrow in Word. I've tried chr(10), chr(13), \u000D, \u000A and a few others, but I can't match it in a string.replace(). S...