I am now moving to eclipse for my python development. I have pydev installed but it is showing grammar support up to python version 3.0. My question is can I use python 3.1 with 3.0 grammar? Has the grammar changed from version 3.0 to 3.1?
I am using eclipse 3.4.2 and pydev 1.4.7
...
Hi
I keep getting invalid syntax with the below:
if (row[0] == year) and (row[1] == month) and (row[2] == day and (row[3] == hour) and (row[4] == minute):
print "hello"
else:
print "hello2"
Any ideas?
...
Hey!
I have a dictionary, lets call it myDict, in Python that contains a set of similar dictionaries which all have the entry "turned_on : True" or "turned_on : False". I want to remove all the entries in myDict that are off, e.g. where "turned_on : False". In Ruby I would do something like this:
myDict.delete_if { |id,dict| not dict[:...
Hi,
I'm searching for an elegant way to convert a normal Python dict with some nested dicts to an object.
For example:
>>> d = {'a': 1, 'b': {'c': 2}, 'd': ["hi", {'foo': "bar"}]}
Should be accessible in this way:
>>> x = dict2obj(d)
>>> x.a
1
>>> x.b.c
2
>>> x.d[1].foo
bar
I think, this is not possible without recursion, but wha...
Obj-C (which I have not used for a long time) has something called categories to extend classes. Declaring a category with new methods and compiling it into your program, all instances of the class suddenly have the new methods.
Python has mixin possibilities, which I use, but mixins must be used from the bottom of the program: the clas...
Does anyone know how to get the list of items and check/uncheck items in a CheckedListBox from python?
I've found this to help me partly on the way. I think I've found the handle for the CheckedListBox(listed as a SysTreeView32 by WinGuiAuto.py).
One usage will for my part be to create an autoinstaller that manages to uncheck all checkb...
Has anyone got a working code example of how to connect to the windows message queue(post/sendMessage) and log all messages there? Preferably in Python.
I'm interrested in this to easier be able to create test-scripts that emulates user input.
...
I am using python to open an email on the server (POP3). Each email has an attachment which is a forwarded email itself.
I need to get the "To:" address out of the attachment.
I am using python to try and help me learn the language and I'm not that good yet !
The code I have already is this
import poplib, email, mimetypes
oPo...
>>> import psycopg2
Traceback (most recent call last):
File "", line 1, in
File "C:\Python26\lib\site-packages\psycopg2\__init__.py", line 60, in
from _psycopg import BINARY, NUMBER, STRING, DATETIME, ROWID
ImportError: DLL load failed: The application has failed to start because its si
de-by-side configuration is incorrect. P...
Amazon Product API now requires a signature with every request which I'm trying to generate ushing Python.
The step I get hung up on is this one:
"Calculate an RFC 2104-compliant HMAC with the SHA256 hash algorithm using the string above with our "dummy" Secret Access Key: 1234567890. For more information about this step, see documenta...
I have tried this on the python interpreter:
>>> a=set('abcde')
>>> a
set(['a', 'c', 'b', 'e', 'd'])
>>> l=['f','g']
>>> l
['f', 'g']
>>> a.add(l)
Traceback (most recent call last):
File "<pyshell#35>", line 1, in <module>
a.add(l)
TypeError: list objects are unhashable
I think that I can't add the list to the set because there'...
I have the following code which I use to map a nested list in Python to produce a list with the same structure.
>>> nested_list = [['Hello', 'World'], ['Goodbye', 'World']]
>>> [map(str.upper, x) for x in nested_list]
[['HELLO', 'WORLD'], ['GOODBYE', 'WORLD']]
Can this be done with list comprehension alone (without using the map func...
Is there a python convention for when you should implement __str__() versus __unicode__(). I've seen classes override __unicode__() more frequently than __str__() but it doesn't appear to be consistent. Are there specific rules when it is better to implement one versus the other? Is it necessary/good practice to implement both?
...
I have an implemented of Pearson's Similarity score for comparing two dictionaries of values. More time is spent in this method than anywhere else (potentially many millions of calls), so this is clearly the critical method to optimise.
Even the slightest optimisation could have a big impact on my code, so I'm keen to explore even the s...
Good day code knights,
I have a tricky problem that I cannot see a simple solution for. And the history of the humankind states that there is a simple solution for everything (excluding buying presents)
Here is the problem:
I need an algorithm that takes multidimensional lists and a filter dictionary, processes them and returns lists ...
I'd like to know how to pragmatically pull lists of apps from the iphone app store. I'd code this in python (via the google app engine) or in an iphone app. My goal would be to select maybe 5 of them and present them to the user. (for instance a top 5 kind of thing, or advanced filtering or queries)
...
I'm evaluating "test frameworks" for automated system tests; so far I'm looking for a python framework.
In py.test or nose I can't see something like the EXPECT macros I know from google testing framework.
I'd like to make several assertions in one test while not aborting the test at the first failure.
Am I missing something in these fra...
I wrote a plug-in for the jetbrains tool teamcity. It is pretty much just a server listener that listens for a build being triggered and outputs some text files with information about different builds like what triggered it, how many changes there where ect ect. After I finished that I wrote a python script that could input info into tea...
Hi
I'm trying to get this Python MYSQL update statement correct(With Variables):
cursor.execute ("UPDATE tblTableName SET Year=%s" % Year ", Month=%s" % Month ", Day=%s" % Day ", Hour=%s" % Hour ", Minute=%s" Minute "WHERE Server=%s " % ServerID)
Any ideas where I'm going wrong?
...
I want to store which user invited another user to a group... but django is telling me this is ambigous and against the rules (which makes sense).
groups.group: Intermediary model
Group_to_Member has more than one
foreign key to User, which is
ambiguous and is not permitted.
So how do I do this correctly? Maybe a generic rel...