Possible Duplicate:
What is the most pythonic way to iterate over a list in chunks?
I want to loop through a Python list and process 2 list items at a time. Something like this in another language:
for(int i = 0; i < list.length(); i+=2)
{
// do something with list[i] and list[i + 1]
}
What's the best way to accomplish t...
Dear SO,
I'm trying to use OpenCV v2.1. Using cv.FindChessboardCorners I've found a bunch of corresponding points between two webcams.
Using the function cv.FindFundamentalMat I've generated a fundamental matrix relating the two cams. But now I want to use cv.StereoRectifyUncalibrated. The documentation specifies that the same format f...
Does python compile down to some byte code or is it rendered on the fly each time like php/asp?
From my readings I read it has its own byte code format, so i figured it was like java/.net where it compiles into a intermediate language/byte code.
so it is more effecient in that respect that php right?
...
I am trying to write a simple custom button in wx.Python. My code is as follows, an error is thrown on line 19 of my "Custom_Button.py" - What is going on? I can find no help online for this error and have a suspicion that it has to do with the Polymorphism. (As a side note: I am relatively new to python having come from C++ and C# any h...
Hi,
I am trying to use the Python C API to define a new class inside a module that would expose certain functionality written in C to Python code. I specifically want to have it in the form of a class and not a set of module functions.
However, I can't find anything regarding this particular task in the official documentation. The clos...
The problem is that my servlet doesn't fetch the parameter "protocolversion" (see below) for my Python script for some odd reason. The getParameter call always returns null! Is perhaps the HTTP post request invalid? I use Tomcat 6 with default configuration. A strange thing I've noticed when logging with Wireshark is that Tomcat responds...
Using a regex in Python, how can I verify that a user's password is:
At least 8 characters
Must be restricted to, though does not specifically require any of:
uppercase letters: A-Z
lowercase letters: a-z
numbers: 0-9
any of the special characters: @#$%^&+=
Note, all the letter/number/special chars are optional. I only want to ver...
going through both the django book and tutorial, am a bit confused to the differences in approach (aren't they both written by the same people?)
can anyone who has experience in both give a short review on them? i have decent python skills (largely untested though), but no experience at all in web apps and am trying to decide which one...
Hello, I'm having problems with macOSX and virtualenv. It seems to ignore --no-site-package.
Using exactly the same commands with linux (archlinux) it works. It it macOSX 10.5 with python 2.5
curl -o virtualenv.py 'http://bitbucket.org/ianb/virtualenv/raw/tip/virtualenv.py
Create a new environment
python virtualenv.py --no-site-packa...
>>> t1 = "abcd.org.gz"
>>> t1
'abcd.org.gz'
>>> t1.strip("g")
'abcd.org.gz'
>>> t1.strip("gz")
'abcd.org.'
>>> t1.strip(".gz")
'abcd.or'
Why does the 'g' of '.org' is gone?
...
Hi there,
I'm doing a project with reasonalby big DataBase. It's not a probper DB file, but a class with format as follows:
DataBase.Nodes.Data=[[] for i in range(1,1000)] f.e. this DataBase is all together something like few thousands rows. Fisrt question - is the way I'm doing efficient, or is it better to use SQL, or any other "prope...
I know it is a kind of broad question but any answer are appreciated.
...
Hi there,
I've big class in Python it's "DataBase-like" class. I want to save it to file - all including data.
This is input(example to show the issue, in script database is like 10000 records):
import cPickle
# DataBase-like class
class DataBase:
class Arrays: pass
class Zones: pass
class Nodes:
class CR: pass ...
If a YouTube video is set as private and I try to fetch it using the gdata Python API a 404 RequestError is raised, even though I have done a programmatic login with the account that owns that video:
from gdata.youtube import service
yt_service = service.YouTubeService(email=my_email,
password=my_pass...
I have ascii strings which contain the character "\x80" to represent the euro symbol:
>>> print "\x80"
€
When inserting string data containing this character into my database, I get:
psycopg2.DataError: invalid byte sequence for encoding "UTF8": 0x80
HINT: This error can also happen if the byte sequence does not match the encodi
ng ...
Hello guys!
Actually this is an interesting topic from programming pearls, sorting 10 digits telephone numbers in a limited memory with an efficient algorithm. You can find the whole story here
What I am interested in is just how fast the implementation could be in python. I have done a naive implementation with the module bitvector. T...
I'm writing an application that sends files over network, I want to develop a custom protocol to not limit myself in term on feature richness (http wouldn't be appropriate, the nearest thing is the bittorrent protocol maybe).
I've tried with twisted, I've built a good app but there's a bug in twisted that makes my GUI blocking, so I've...
I'm using Suds to access a SOAP web service from python. If I have multiple threading.Thread threads of execution, can each of them safely access the same suds.client.Client instance concurrently, or must I create separate Client objects for each thread?
...
Recently came across pidgin. Its great, and does what I want, but I am not too keen on the GPL license. Other any alternatives, with less restrictive licenses?
I would prefer the library to be C or C++, as I am most familiar with those languages, but a an IM library implemented in python would be interesting too.
...
The substance of an app is more important to me than its apperance, yet GUI always seems to dominate a disproportionate percentage of programmer time, development and target resource requirements/constraints.
Ideally I'd like an application architecture that will permit me to develop an app
using a lightweight reference GUI/kit and foc...