Hello there,
I am pretty stumped at the moment. Based on http://stackoverflow.com/questions/1045628/can-i-use-win32-com-to-replace-text-inside-a-word-document I was able to code a simple template system that generates word docs out of a template word doc (in Python).
My problem is that text in "Text Fields" is not find that way. Even i...
how would i search through a list with ~5 mil 128bit (or 256, depending on how you look at it) strings quickly and find the duplicates (in python)? i can turn the strings into numbers, but i don't think that's going to help much. since i haven't learned much information theory, is there anything about this in information theory?
and si...
I'd like to make a class extending the numpy array base type,
class LemmaMatrix(numpy.ndarray):
@classmethod
def init_from_corpus(cls, ...): cls(numpy.empty(...))
But apparently, it will not allow multi-dimensional array types. Is there a way around this? Thanks in advance!
ndarray(empty([3, 3]))
TypeError: only length-1 arra...
I'm using setuptools for a Python script I wrote
After installing, I do:
$ megazord -i input -d database -v xx-xx -w yy-yy
Like I would if I was running it ./like_this
However, I get:
Traceback (most recent call last):
File "/usr/local/bin/megazord", line 9, in <module>
load_entry_point('megazord==1.0.0', 'console_scripts', '...
The python shelf module only seems to be allow string keys. Is there a way to use arbitrary typed (e.g. numeric) keys? May be an sqlite-backed dictionary?
Thanks!
...
In Python I have a list of n lists, each with a variable number of elements. How can I create a single list containing all the possible permutations:
For example
[ [ a, b, c], [d], [e, f] ]
I want
[ [a, d, e] , [a, d, f], [b, d, e], [b, d, f], [c, d, e], [c, d, f] ]
Note I don't know n in advance. I thought itertools.product wou...
Hi,
I have a table in MySql DB which I want to load it to a dictionary in python.
the table columns is as follows:
id,url,tag,tagCount
tagCount is the number of times that a tag has been repeated for a certain url. So in that case I need a nested dictionary, in other words a dictionary of dictionary, to load this table. Because each u...
I'm using python 2.6.4 and discovered that I can't use gzip with subprocess the way I might hope. This illustrates the problem:
May 17 18:05:36> python
Python 2.6.4 (r264:75706, Mar 10 2010, 14:41:19)
[GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import...
contacts.remove((name,ip))
i have the ip and its unique, i want to remove this tuple from contacts according to the ip and no need to name,
i just tried this "contacts.remove((pass,ip))", but i encountered an error.
...
I try to adhere to the style guide for Python code (also known as PEP 8). Accordingly, the preferred way to name a class is using CamelCase:
Almost without exception, class names
use the CapWords convention. Classes for internal use have a leading underscore in addition.
How can I be consistent with PEP 8 if my class name is form...
I'm not sure if there is even anything out there to do this. Is there any libraries out there that can reword sentences to any degree of accuracy? It doesnt have to be too intelligent.
...
I have a number of scripts written in Python 2.6 that can be run arbitrarily. I would like to have a single central script that collects the output and displays it in a single log.
Ideally it would satisfy these requirements:
Every script sends its messages to the same "receiver" for display.
If the receiver is not running when the fi...
I'm putting in some effort to learn Python, and I am paying close attention to common coding standards. This may seem like a pointlessly nit-picky question, but I am trying to focus on best-practices as I learn, so I don't have to unlearn any 'bad' habits.
I see two common methods for initializing a dict:
a = {
'a': 'value',
'...
I was working on a program,that I need to support new additions. Hmmm. Let me give you some background on the program.
It is an educational software program that has quizzes for the user to take, just to gain odd knowledge. Now, It currently supports 6 subjects, all organized with directores on the HDD ( i.e. the Science directory is ca...
What's the "python way" to recursively set the owner and group to files in a directory? I could just pass a 'chown -R' command to shell, but I feel like I'm missing something obvious.
I'm mucking about with this:
import os
path = "/tmp/foo"
for root, dirs, files in os.walk(path):
for momo in dirs:
os.chown(momo, 502, ...
Do you know of any python mapreduce ready clustering libraries?
I have found some good libraries in Java (http://lucene.apache.org/mahout/), I'd prefer to use python though.
http://wiki.github.com/klbostee/dumbo/ (Python mapreduce API )
Edit ---
I'm looking for mapreduce ready : Canopy, K-means, Means-shift,etc..
...
Using Python 2.5 and PyQt 4.4.3, I couldn't find any question this specific in Python, so sorry if I'm repeating the other Qt referenced questions below, but I couldn't easily understand that C code.
I've got two classes, a GUI and a thread, and I'm trying to get return values from the thread. I've used the link in here as base to write...
My simple GAE app is not redirecting to the /static directory for requests when url is multiple levels.
Dir structure:
/app/static/css/main.css
App:
I have two handlers one for /app and one for /app/new
app.yaml:
handlers:
- url: /static
static_dir: static
- url: /app/static/(.*)
static_dir: static\1
- url: /app/.*
scrip...
How do I randomly add buttons to a Tkinter GUI? I need it to be able to create a button, then put it anywhere on the window, is this possible? I am using Python 2.6 on Windows.
...
it's annoying how sqlite always returns a list of touples! i can see the why this is necessary, but when i am querying a single column, how do i get a plain list?
e.g cursor.fetchall() returns [(u'one',), (u'two',), (u'three',)]
from this, how do i get the simple list [u'one', u'two', u'three']?
...