Hello, I'm stumped with a problem illustrated in the sample below:
"ID","NAME","PHONE","REF","DISCARD"
1,"JOHN",12345,,
2,"PETER",6232,,
3,"JON",12345,,
4,"PETERSON",6232,,
5,"ALEX",7854,,
6,"JON",12345,,
I want to detect duplicates in column "PHONE", and mark the subsequent duplicates using the column "REF", with a value pointing to ...
In ubuntu 9.10, in usr/lib/ there are the directories python2.4, python2.5, python2.6 and python3.0
Only python 2.6 is actually working.
python2.4 has only a lib-dynload directory,
python2.5 has only lib-dynload and site-packages,
python3.0 has only a dist-packages directory.
Now i'm wondering what is the idea behind this?
Because ...
I am working on some code that has to manipulate unicode strings. I am trying to write doctests for it, but am having trouble. The following is a minimal example that illustrates the problem:
# -*- coding: utf-8 -*-
def mylen(word):
"""
>>> mylen(u"áéíóú")
5
"""
return len(word)
print mylen(u"áéíóú")
First we run the code t...
I have a wx.ListBox in a python program, and I wan't to change out the list in it on a wx.Timer update. I have the timer working, I just don't know how to change out the list that it displays.
...
Say I have an array with a couple hundred elements. I need to iterate of the array and replace one or more items in the array with some other item. Which strategy is more efficient in python in terms of speed (I'm not worried about memory)?
For example: I have an array
my_array = [1,2,3,4,5,6]
I want to replace the first 3 elements ...
I am looking to write a Key/value store (probably in python) mostly just for experience, and because it's something I think that is a very useful product. I have a couple of questions. How, in general, are key/value pairs normally stored in memory and on disk? How would one go about loading the things stored on disk, back into memory? Do...
Hi,
I have some funny noob problem.
I try to run unit tests from commandline:
H:\PRO\pyEstimator>python src\test\python\test_power_estimator.py
Traceback (most recent call last):
File "src\test\python\test_power_estimator.py", line 2, in <module>
import src.main.python.power_estimator as power
ImportError: No module named src.ma...
I'm trying to scrape META keywords and description tags from arbitrary websites. I obviusly have no control over said website, so have to take what I'm given. They have a variety of casings for the tag and attributes, which means I need to work case-insensitively. I can't believe that the lxml authors are as stubborn as to insist on full...
As soon as I add "from django.contrib.gis.db import models" instead of "from django.db import models", Django stops recognizing the app and gives this error:
Error: App with label location could not be found. Are you sure your INSTALLED_APPS setting is correct?
The error goes away as soon as I comment out "from django.contrib.gis.db i...
I'm trying to use Distribute for my project's setup.py. I want it to include all the files in the package folder, which are text and image files, but not .pyc files of course. I read that the files should either be tracked by CVS and SVN, or there should be a MAINFEST.in.
So:
I use neither CVS nor SVN, I use git. I know that it's poss...
I know this is a long shot, but I was wondering if Python had a way to manipulate the screen buffer. Specifically, I want to be able to gray-out my desktop and highlight my windows when I press a key combination. Is this in the realm of possibility?
...
I am a beginner and got an issue, really head around now.
Here is the code:
n=3 #time step
#f, v and r are arrays,eg [3,4,5]
#r,v,f all have initial array which is when n=0
def force():
r=position()
f=r*2
return f
def position(n):
v=velocity(n)
for i in range(n): #This part may wrong...
r=v*i ...
I like programming with robots and stuff. For this approach, I'm using the LPT port for output and the Gameport for input.
For younger guys: Just some old fashioned USB Ports ;-)
With Python (and the fabulous module pyParallel) the output works very, very well.
Now I'd really like to get data from the Game Port (like photo tubes, te...
I want to draw a scene and sequentially add lines to it. But pyglet keeps updating without control :( , so all I get is blinks
from pyglet.gl import *
window=pyglet.window.Window()
def drawline():
...
@window.event
def on_draw():
drawline()
pyglet.app.run()
should I change the decorator(if there exist options) or what?
Tha...
I'll take the simplest of the SQL functions as an example:
CREATE OR REPLACE FUNCTION skater_name_match(INTEGER,VARCHAR)
RETURNS BOOL AS
$$
SELECT $1 IN (SELECT skaters_skater.competitor_ptr_id FROM skaters_skater
WHERE name||' '||surname ILIKE '%'||$2||'%'
OR surname||' '||name ILIKE '%'||$2||'%');
$$ LANGUAGE SQL;
If I ...
i recently switched to mac. first and foremost i installed xampp.
then for django-python-mysql connectivity, i "somehow" ended up installing a seperate MySQL.
now the seperate mysql installation is active all the time and the Xampp one doesnt switch on unless i kill the other one.
what i wanted to know is it possible to make xampp work ...
After doing some processing on an audio or image array, it needs to be normalized within a range before it can be written back to a file. This can be done like so:
# Normalize audio channels to between -1.0 and +1.0
audio[:,0] = audio[:,0]/abs(audio[:,0]).max()
audio[:,1] = audio[:,1]/abs(audio[:,1]).max()
# Normalize image to between...
How do I direct Eclipse to the Python interpreter on my Mac?
I've looked in Library which contains the directory 'Python' then '2.3' and '2.5', however they contain nothing except 'Site-packages' - Which is weird considering I can go into the terminal and type python. I then installed the latest 2.6 version with package manager and stil...
Hi
Is there any production quality library for developing opensocial containers and clients in python and django?
...
I'm just beginning to learn python and the program I'm writing requires parameters for it to run with a specific task. For example (programs name is Samtho)
samtho -i Mozilla_Firefox
How can I do that?
...