I'm an absolute beginner using IDLE (Python 2.6.4) to learn the basics. I recently found a Python program that I want to run but it throws an error although the code looks fine (i.e all modules exist):
from css.parse import parse
data = """
em {
padding: 2px;
margin: 1em;
border-width: medium;
border-style: dashed;...
So a user suggested getting PyQT.
A quick Google gave me this: Link
Is this GUI Library for pay?
If my development environment is Ubuntu Linux, what should I download on that site. I have no idea.
Please provide links if the site I provided is not correct to what I need. Thank you.
...
L = ['abc', 'ADB', 'aBe']
L[len(L):]=['a1', 'a2'] # append items at the end...
L[-1:]=['a3', 'a4'] # append more items at the end...
... works, but 'a2' is missing in the output:
['abc', 'ADB', 'aBe', 'append', 'a1', 'a3', 'a4']
...
Yesterday I came across this article..
http://programminglanguagefaqs.blogspot.com/2009/11/why-organizations-dont-use-python.html
Well, Some points mentioned there stuck my mind...so let's discuss here why any small scale organizations do not prefer Python and go for Java or any other languages??
...
Hello,
I have created a subversion post-commit hook to send out an email everytime a commit is made.Im calling a python script from the file post-commit in /var/svn/repos/hooks .
REPOS="$1"
REV="$2"
~/svnnotify.py $REV
But the problem is that the svn commit command is taking a longer time to terminate as it waits for the python sc...
I'm trying to get the Yahoo! BOSS package working, but when I try to run the example file I get the following error:
$ python examples/ex5.py
File "examples/ex5.py", line 28
tb = db.group(by=["yn$title"], key="rank", reducer=lambda d1,d2: d1+d2, as="total", table=tb, norm=text.norm)
...
For example, here is some code from django.templates.loader.app_directories.py.[1]
try:
yield safe_join(template_dir, template_name)
except UnicodeDecodeError:
# The template dir name was a bytestring that wasn't valid UTF-8.
raise
If you catch an exception just to re raise it, what purpose does it serve?
[1] http://code....
I'm trying to use PIL for a Google App Engine project. I've installed PIL using the installer from pythononmac.org but it doesn't seem to do anything, or at least neither I nor Python can find the files. I'm running Python 2.5.1.
...
Hello,
I need to import contacts of given email id/pwd from gmail,yahoo,hotmail,etc,etc
for python/django app. Please suggest?
-
Thanks,
Aamir hussain
...
I came across this (really) simple program a while ago. It just outputs the first x primes. I'm embarrassed to ask, is there any way to make it more "pythonic" ie condense it while making it (more) readable? Switching functions is fine; I'm only interested in readability.
Thanks
from math import sqrt
def isprime(n):
if n ==2:
...
hi,
I have a C++ application which uses embedded python interpreter with the Python C API. It can evaluate Python files and source code with PyRun_SimpleFile and PyObject_CallMethod.
Now I have a python source code which has a worked thread which subclasses threading.Thread and has a simple run re-implementation:
import time
from thre...
How can I pick tags from an article or a user's post using Python?
Is the following method ok?
Build a list of word frequency from the text and sort them.
Remove some common words and pick the top 10 words remained in the list as the tags.
If the above method is ok, what library can detect if which words are common, like "the, if, y...
Hi, I have a chat client that continuously polls a server and fetches new messages.
From my def __init__() I have:
wx.CallAfter(self.pollServer)
Which is defined:
def pollServer(self):
t = self.updateMessages()
time.sleep(5)
self.pollServer()
Now printing the messages into the Terminal shows that it works but the GUI i...
TextMate seems to use the built-in Python version I assume (sys.path doesn't work). How do you configure it to use 3.1 instead? I've already installed the 3.1 package and I can use IDLE for interactive sessions, but I need to use TextMate now.
Thanks
...
I have upgraded to Python 3 and can't figure out how to convert backslash escaped newlines to HTML. The browser renders the backslashes literally, so "\n" has no effect on the HTML source. As a result, my source page is all in one long line and impossible to diagnose.
I spent hours searching for the solution to no avail. Can anyone help...
What happens when I reload a module in python and the new code for the module is syntactically incorrect? The reload(module) function doesn't seem to be throwing any exception. Is there any way to determine if the reload was successful or failed?
...
Hey guys, this is my first question here on Stack Overflow and I was wondering if I could ask the advice of people who know a bit more about Python and Parser Generators than I do.
I've been given a task where I have to create a parser for a simple C-like language. I can use any programming language and tools I wish to create the parser...
Is there any definitive cheatsheet available for Python (3.1 especially). I'm learning from a book but I keep forgetting the various methods explained for lists, dicts, strings etc..
I'd like a cheatsheet or a tutorial spanning a few pages that has object type definitions, list of expressions, list of methods available for each object t...
i am a engineering student and i have to do a lot of numerical processing, plots, simulations etc. The tool that i use currently is Matlab. I use it in my university computers for most of my assignments. However, i want to know what are the free options available.
i have done some research and many have said that python is a worthy rep...
Dear SO,
I'm trying to write an implementation of Wilson's spectral density factorization algorithm [1] for Python. The algorithm iteratively factorizes a [QxQ] matrix function into its square root (it's sort of an extension of the Newton-Raphson square-root finder for spectral density matrices).
The problem is that my implementation o...