text
stringlengths
226
34.5k
Inform OS of installation Question: Just a question that interested me, I noticed that modern installers (for various types of programs) alert you to wait until another installation is finished before running themselves. **How can I check for that / notify other installers?** _Using c# or python_ Answer: AFAIK ther...
How to batch asynchronous web requests performed using a comprehension in python? Question: not sure if this is possible, spend some time looking at what seem like similar questions, but still unclear. For a list of website urls, I need to get the html as a starting point. I have a class that contains a list of these ...
Installation issues for Virtualenv and VirtualenvWrapper in Ubuntu 13.04 Question: Ubuntu Server in VirtualBox. I am trying to install VirtualEnv to start learning Flask and bottle. Some details of my setup. vks@UbSrVb:~$ cat /etc/os-release NAME="Ubuntu" VERSION="12.04.2 LTS, Precise Pangolin" ...
Python scripts on DD-WRT embedded router Question: I've written two Python (2.x) scripts to perform the following: 1. Custom Proxy server (imports optparse, ConfigParser, TLDextract, SocketServer...) 2. Web admin for proxy (imports flask, ConfigParser, netifaces...) These are both currently running on a Raspberry...
Understanding Popen.communicate Question: I have a script named `1st.py` which creates a REPL (read-eval-print-loop): print "Something to print" while True: r = raw_input() if r == 'n': print "exiting" break else: print "continuing" I ...
python access selective files with glob module Question: I have a collection of binary files which have names as so: d010-recomb.bin d011-recomb.bin ............. ............. ............. d100-recomb.bin Using the python glob module, i can access all the files in a folder and...
Where do I initialize my webdriver in Django using Selenium along django.test Question: I am willing to test my Django application using Selenium. From what I read, Django already cover the testing part and allow you to write your own tests. Willing to use this with Selenium, here is my `<application>/test.py`: ...
Cython, Python and KeyboardInterrupt ignored Question: Is there a way to interrupt (`Ctrl+C`) a Python script based on a loop that is embedded in a Cython extension? I have the following python script: def main(): # Intantiate simulator sim = PySimulator() sim.Run() ...
Adding two number isn't working on heroku Question: Why this code is not running on heroku? (Internal server error) import os from flask import Flask app = Flask(__name__) @app.route('/') def hello(): a = 10 b = 20 c = a + b return c ...
Python & Tide SDK - import external module? Question: Since python is bundled with the Tide SDK, I can't figure out how to use access external modules. I've tried copying the module folder "Lib/site- packages/YourModuleHere" to the tide SDK directory, and this suggestion here: [TIdeSDK Python module import](http://stac...
PyQT4 how to using def from others model Question: This code works: import sys from PyQt4 import QtCore, QtGui, QtWebKit from forma import Ui_MainWindow class MyForm(QtGui.QMainWindow): def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) ...
python, module object is not callable, calling method in another file Question: I have a fair background in java, trying to learn python. I'm running into a problem understanding how to access methods from other classes when they're in different files. I keep getting module object is not callable. I made a simple func...
heroku PostGIS syncdb error Question: I am having trouble getting a simple GeoDjango app running on heroku. I have created the postgis extension for my database but I am not able to run syncdb without getting the following error: from django.contrib.gis.geometry.backend import Geometry File "/app/.he...
Python data scraping with Scrapy Question: I want to scrape data from a website which has TextFields, Buttons etc.. and my requirement is to fill the text fields and submit the form to get the results and then scrape the data points from results page. I want to know that does Scrapy has this feature or If anyone can r...
Raise an exception at import if conditions not met Question: I have a module that depends on some system settings. For example, to work properly it needs to have an environment variable FOO set. I would like the module to raise an Exception if this condition is not met at import time. # mymodule.py i...
How to properly treat feature branches and package interdependencies? Question: While trying to stick to the branching model from [http://nvie.com/posts/a-successful-git-branching-model ![](http://nvie.com/img/2009/12/Screen- shot-2009-12-24-at-11.32.03.png)](http://nvie.com/posts/a-successful-git- branching-model) ,...
which numbers in list 2 are bigger and smaller than each number in list 1 Question: i am using python. i have two lists, list 1 is 7000 integers long, list 2 is 25000 integers. i want to go through each number in list 1 and find the closest number in list 2 that is bigger and the closest number that is smaller than eac...
How can you specify a default value, using a function, in a gimp python plugin? Question: I am trying to get gimp to use a reasonable default path in a "save as" plugin, and to do that I need to be able to specify the default with the return value of a function (I believe). Currently, my code is something like: ...
Use Multiple DBs With One Redis Lua Script? Question: Is it possible to have one Redis Lua script hit more than one database? I currently have information of one type in DB 0 and information of another type in DB 1. My normal workflow is doing updates on DB 1 based on an API call along with meta information from DB 0. ...
Matching Regex in Python Question: I wanted to match a certain pattern to a few strings with a one regex line (if possible): blah blah (1023 mega lbs) blah blah 1245 tons blah 1023 kilo tons blah blah 1034 metric tons blah 1023 feet 345 blah $100 is a lot of money I want to match number...
Installed new version of python, Now I can't use the libraries I've installed for the older version in Mac Question: I am using an older version of **Python 2.7.3** , but I realize that it is a 32 bit version and I needed a **64 bit** version to be able to use `MySQLdb`. Also, I have other libraries that I have downlo...
Tkinter - Text widget shrinks when Scrollbar is added Question: I'm working on the GUI for a simple quiz app using Tkinter in Python 2.7. Thus far, I have begun to set up my frame. I've put a scrollbar inside of a Text widget named `results_txtbx` to scroll up and down a list noting the player's performance on each que...
Python: compare one list's index to another, append second list value to first list Question: I have a .csv file as follows (snippet). Country,Year,GDP ($US),Population Angola,2002,11431738368,10760510 Angola,2005,32810672128,11706954 Antigua and Barbuda,2002,714677760,67448 Antigua and B...
Test with imperative xfail in py.test always reports as xfail even if the passes Question: I always thought that imperative and declarative usage of xfail/skip in py.test should work in the same way. In the meantime I've noticed that if I write a test that contains an imperative skip the result of the test will always ...
matplotlib: ways of drawing a CDF Question: In `python`, with `matplotlib`, I have to draw **2 CDF curves** on the same plot: one for data A, one for data B. If I were to decide the "**binning** " myself, I would do the following and take 100 histograms based on data A. (in my case, A is always at most 50% of the size...
How to do the following operation in python in tricky way? Question: I have a list of tuples as follows [(1,4),(3,5),(2,9),(6,23),(3,21),(2,66),(5,20),(1,33),(3,55),(1,8)] Now I need something like this 1. In the above list, each element is a tuple and the first item in a tuple is an index and t...
Python: share the command line argument to os.system call Question: I am new to python. I searched and trying following approach: I have 3rd party application called "xyz", which takes n argument. I would like to warp this "xyz" into my module called "abc.py" which required m arguments. I would like to read and keep...
Using code from a dependency in setup.py Question: I have a little web framework, let's call it Bread, which is used to build applications like Jam, Marmalade, PeanutButter, and other toppings. Bread both _builds_ and _serves_ these applications. I'm trying to figure out how to make the applications' `setup.py`s work,...
Python I/O and string matching Question: I realize this is probably really easy, I want the equivalent of this C code in Python: #include <stdio.h> #include <string.h> #define BUFFER 200 int main() { char buffer[BUFFER]; while (fgets(buffer, BUFFER, stdin)) { ...
Change string Beautiful Soup Question: I have a problem writing code in Python and BS4. Assuming have the next paragraph: <p id="paragraph"> Here is the paragraph <a href="/" id="url">Here an url</a> the paragraph continues. </p> I take the id and use `replace_with` to replace the string (...
how to make python3.3 gui window fixed sizes? Question: as for the question mentioned, i cant find any code which can fixed the gui window and positions of all the labels, buttons etc.. import tkinter import tkinter.messagebox class Menu: def __init__(self): self.mai...
Python convert a paritcular string to dict Question: The format of string is like `"a:1 b:2 c:x d:2.13e-5"`, is there some way to convert it to python dict quickly and simply? \-------------- edit line -------------- According the great answers, I tried several methods (in ipython): In [6]: import re ...
How to read JUST filenames of a directory in python and then do the same job for all? Question: I have a python script which has this line at the very beginning to read from an input data file: x,y = genfromtxt('data1.txt').T Then I proceed and do the processing on x,y (it depends on a fixed pa...
default colorbar for matplotlib Question: I'd like to change the global default colorbar for all graphics commands in Python matplotlib. This is similar to [this question about changing the default colorbar in MATLAB](http://stackoverflow.com/questions/6034903/how-do- you-set-a-custom-default-colormap-in-matlab). Here ...
Python Iterative Loop Plot values Question: I am trying to carry out an iterative calculation in python using a finite difference method. I found the finite difference method from this: <http://depa.fquim.unam.mx/amyd/archivero/DiferenciasFinitas3_25332.pdf> The values that the code calculates are correct. The proble...
Python if/elseif construction as dictionary Question: In Python I use regularly the following construct: x = {'a': 1, 'b': 2, 'c': 3, 'd': 4} y = x[v] if v in x.keys() else None where v is normally one of the dictionary values, and y gets the value of the dictionary if the key exists, otherwise...
Extracting the extracted with python Question: I have a zip file containing thousands of mixed .xml and .csv files. I used the following to extract the zip file: import zipfile zip = zipfile.ZipFile(r'c:\my.zip') zip.extractall(r'c:\output') Now I need to extract the thousands of ...
Printing error in Python? Question: I'm new to Python, I've only done programming in Java before recently. I am writing a basic program in Python to print out the 1000th prime number and while I did get it to work, for some reason it's also printing out the next 7 numbers unless I use an unnecessary break: ...
Skip the last row of CSV file when iterating in Python Question: I am working on a data analysis using a CSV file that I got from a datawarehouse(Cognos). The CSV file has the last row that sums up all the rows above, but I do not need this line for my analysis, so I would like to skip the last row. I was thinking abo...
Random String Generation Based on Regular Expression-Python Question: According to the [this](https://bitbucket.org/leapfrogdevelopment/rstr/) random strings can be generated importing rstr module. import rstr rstr.rstr('ABC') but when I compile this following error is given? Imp...
python to exe convert part of the code Question: Very good, anyone know if I can make exe single piece of code in a script, for example: one file (hello.py): print('hello word') def exit(): print('good bye') two file (setup.py): from distutils.core import setup ...
How to sort nested lists into seperate lists with unique values in python? Question: I have two variables: unique_val = [1,2,3] nested_list = [['name1',1],['name2',1],['name3',3],['name4',2],['name5',2],['name6',3]] Basically I want separate lists of the names at each unique value. I struggled ...
How to dynamically create classes inside a module-level initialize() method in Python Question: I'm writing a library to talk to a database using SQLAlchemy. I really like SQLAlchemy's `autoload_with=engine` feature, which can be passed to the `Table` constructor to grab all of the table's columns without the programme...
Python: Importing from a running instance, or an alternative Question: I have 2 files, data.py and interpret.py. data.py: X = cPickle.load(open("X","r")) interpret.py: from data import X query = raw_input("Enter query") #do something with query and X Object X whic...
Move tkinter label using button command Question: I am trying to recreate the boardgame monopoly using python and tkinter. I know how to place a label on a canvas or a frame, but how should I do this command is being run from another function in the class? I tried it using some function within the class Board, but then...
Using Python Ctypes to pass struct pointer to a DLL function Question: I am attempting to access a function in a DLL file using Python ctypes. The provided function description is below. Prototype: Picam_ConnectDemoCamera( PicamModel model, const pichar* serial_num...
SQLite Data Change Notification Callbacks in Python or Bash or CLI Question: SQLite has [Data Change Notification Callbacks](http://www.sqlite.org/c3ref/update_hook.html) available in the C API. Can these callbacks be used from the SQLite CLI, or from Bash or from Python? If so, how? Answer: > Can these callbacks be...
Tkinter not displaying image Question: I have this code: from tkinter import * import urllib import urllib.request from bs4 import BeautifulSoup import Pydeck import sys from collections import defaultdict root = Tk() name="" def buttonclicked(): name() ...
Python urllib2 Images Distorted Question: I'm making a program using the website <http://placekitten.com>, but I've run into a bit of a problem. Using this: im = urllib2.urlopen(url).read() f = open('kitten.jpeg', 'w') f.write(im) f.close() The image turns out distorted with mismatched ...
How do I get python code to loop every x mins between the times y and z? Question: This might be incredibly easy but how do I get python code to loop every x mins between the times y and z? For example if I wanted my script to run between midnight (00:00) through to 10 pm (22:00) looping every 5 minutes. Answer: Try...
Python program won't respond until keyboard interrupt Question: I'm trying to draw an image with PyGame, and I copied this code from Adafruit. It's strange, seems nothing displays on the screen until I Ctrl-C, at which time it shows the image. Then the image stays on the screen until I press Ctrl-C again. I then get th...
using twitter api from python to post messages Question: [diveintopython3](http://www.diveintopython3.net/http-web-services.html) tells how you can post a message to [`identi.ca`](http://identi.ca/) >>> from urllib.parse import urlencode >>> import httplib2 >>> httplib2.debuglevel = 1 >>> h =...
How can I speed up this really basic python script for offsetting lines of numbers Question: I have a simple text file which contains numbers in ASCII text separated by spaces as per this example. 150604849 319865.301865 5810822.964432 -96.425797 -1610 319734.172256 5810916.074753 -52.490280 -...
Emacs and Git show wrong time on Windows Question: Emacs is two hours off from the system time. I tried to google for the problem, but no luck. What do I need to configure to correct this? I suspect this to be the difference from GMT to where I live (I'm in GMT+2 zone, that is, if I subtract from system time 2, I'll ge...
Python remove duplicate cases that are in inverted matrix Question: I have a list that looks like this: relationShipArray = [] relationShipArray.append([340859419124453377, 340853571828469762]) relationShipArray.append([340859419124453377, 340854579195432961]) relationShipArray.append([3...
How to find every integer that is the closest to the antilogarithm (10base) for a series of n*0.1 (in Python) Question: In my algorithm I want to evaluate if the current integer n happens to be closest to the antilogarithm of any positive multiple of 0.1, so 0.1, 1.0, 1.1, 7.9, 21.5 etc. Antilog? AntiLog(x) = 10x I f...
TypeError when multiplying matrices Question: I'm trying to multiply some matrices together and I keep getting a type error for the last multiplication (calculating C). All the other multiplications proceed correctly, but I get the error: Traceback (most recent call last): File "C:\Python27\Lab2_Ma...
Send images using sockets Python Question: I have some problems with this code... send not the integer image but some bytes, is there someone than can help me? I want to send all images I find in a folder. Thank you. # CLIENT import socket import sys import os s = socket.socket() s....
Making a video with opencv, getting only 1 frame Question: I've been trying to add a video making module to my program using opencv, but try as I might I can't get the video to show more than 1 frame. I got this example code while searching for answers ([Creating a video using OpenCV 2.4.0 in python](http://stackoverfl...
QMutex.unlock doesn't wake all blocked threads Question: I use Qt 4.8.4 and PyQt 4.10 Here is my test code: #!/usr/bin/env python3 import sys from PyQt4.QtCore import * from PyQt4.QtGui import * class Thread1(QThread): def run(self): print('thread1 %d' % QTh...
Dropbox python sdk import error Question: I am trying to use the dropbox sdk for python. I installed a virtual enviroment and used pip install to install dropbox-sdk. When I try to run the example code (see below) I get a importerror client cannot be found, but if I try to do it from the interactive intreperter it work...
Django register and login - explained by example Question: Can someone please explain in details how to make a **registration** and **authentication** in as easy words as possible ? I made authentication (login) with `django.contrib.auth` but what I want to get is a full register(social/non)+login. Already saw the `dja...
Is there some way to decrease memory requirement in these implementations of Sieve of Eratosthenes Question: I am using Python 2.7 Among the two implementations of Sieve of Eratosthenes erat() and erat2() that I wrote erat2() has the benefit that on the 2nd run of erat2() it gives the results in comparatively much les...
python socket and socketserver Question: I've been trying to make a multi-client server and i finally have and it works perfectly but what I want to do now is to instead of getting the clients address, get the client to type their name in and then the program will say "Bob: Hi guys" instead of "127.0.0.1: Hi guys". I ...
py2exe and disappeared icon Question: I am using pyqt, icon is added. icon.addPixmap(QtGui.QPixmap(_fromUtf8("favicon.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off) MainWindow.setWindowIcon(icon) In setup.py for py2exe, I am trying to add my icon to resources. from distutils.core i...
Implementing MVC in Python? (using Flask and MongoKit) Question: I'm coming from a spaghetti code PHP background. I'm trying to learn MVC by cutting my teeth on Python with Flask and MongoDB. I think this question could apply to other situations. It's more of a newbie Python question. But this is where I'm running into...
Find string matches count in list using Python Question: I read a text file for some analysis, each word is appended to a list and given an id #!/usr/bin/python3 with fi as myfile: for line in myfile: for item in line.split(' '): db[0].append(id_+1) db[2].append(item...
What does translate mean in pypy? Question: I'm reading [pypy's document](http://doc.pypy.org/en/latest/getting-started- python.html), which has a section called _Translating the PyPy Python interpreter_. But i don't understand what does the word _translate_ mean. Is it the same as _compile_? The document says: > Fir...
What is the init function of a dynamic module in python? Question: I am getting the same error of these other two questions: [ImportError: dynamic module does not define init function, but it does](http://stackoverflow.com/questions/5041861/importerror-dynamic-module- does-not-define-init-function-but-it-does) and [Cyt...
SQL parsing using pyparsing Question: I am learning PyParsing in last few weeks. I plan to use it to get table names from SQL statements. I have looked at <http://pyparsing.wikispaces.com/file/view/simpleSQL.py>. But I intend to keep the grammar simple because I am not trying to get every part of select statement parse...
How to define start and end times in python Question: I am using the code def run_periodically(start, end, interval, func): event_time = start while event_time < end: s.enterabs(event_time, 0, func, ()) event_time += interval + random(-5, 45) s.run() ...
Python: return files in directory and subdirectory Question: Trying to create a function that returns the # of files found a directory and its subdirectories. Just need help getting started Answer: One - liner import os cpt = sum([len(files) for r, d, files in os.walk("G:\CS\PYTHONPROJECTS")]) ...
How do I create a module for a fibonacci sequence in Python on a Mac with TextWrangler? Question: I've been trying to search up valid sequences online but haven't come across one that works in Python interpreter. Every time I input a sequence, the interpreter always finds some sort of mistake or is not able to formulat...
Python script to run background services over SSH Question: Summary: I am ssh'ing to a remote server and executing a fork1.py script over there which is shown below. But the trouble is that I want the processes to execute in the background, so that I can start multiple services. I know we can use nohup, etc. but they a...
Why am I getting an apache server error page on a django vhost using underscore in my subdomain? Question: I'm using django 1.5.0 and apache 2.2.22. I can't seem to get my site running as a named vhost (I've got other django sites already running fine on this server). I'm getting the standard apache 500 error page. My...
Call functions in PyDev Eclipse in form generated by Qt Designer Question: python version 3.3.2 ide: PyDev Eclipse with PyQt installed I designed a gui in Qt Designer, saved the .ui file and convert it into python code with this command: pyuic4 -x DeA.ui -o DeA.py ![my designed gui in Qt Designer...
Code window for websites Question: I am the webmaster from [www.idoodler.de](http://www.idoodler.de), I started a Raspberry Pi how to site. The site contains Python, Ruby, Shell Script… scripts. My question: Is is there a HTML code that formats the code like in Stackoverflow? Like this: import os ...
How to test command line scripts with nose? Question: I've created a Python library with some command-line scripts in a 'bin' directory (so that `setup.py` will install it into 'bin' when installing it with `pip`). Since this isn't a Python module, I can't work out how to test it with nose. How can I test a command li...
How to push into array nested in dictionary? Question: I want to create a mongodb to store the homework results, I create a `homework` which is a dictionary storing the results' array of each subject. import pymongo DBCONN = pymongo.Connection("127.0.0.1", 27017) TASKSINFO = DBCONN.tasksinfo...
Python: Pause for-loop while application closes Question: I have a script that I would like to bulk edit powerpoint files with. If I edit files one by one with it, it works great. If I bulk edit them, it fails. I assume this is because the application is not closing before the next file attempts to load, but I could, a...
Building a GeoJSON with Python Question: I want to generate dinamically a geoJSON with a variable number of polygons. Example for 2 polygons: { "type": "FeatureCollection", "features": [ {"geometry": { "type": "GeometryColle...
ASP.NET equivalent to Python's os.system([string]) Question: I have an app made in Python, which accesses a Linux server's command prompt with `os.system([string])` Now I'd like to transfer this away from Python, into some language like ASP.NET or something. Is there a way to access the server's command prompt and ru...
Find top-level directory from subdirectory on Linux in Python Question: I am creating various HTML file parts, image thumbnails etc. from within a `CodeIgniter` application tree using cron-scheduled `Python 2.7` programs on Linux. The actual Python programs exist under the `CodeIgniter` tree in a subdirectory one level...
Passing values and calling functions from other functions Question: I have this class that consists of 3 functions. Each function is in charge of one part of the whole process. `.load()` loads up two files, re-formats their content and writes them to two new files. `.compare()` takes two files and prints out their di...
Python: split on either a space or a hyphen? Question: In Python, how do I split on either a space or a hyphen? Input: You think we did this un-thinkingly? Desired output: ["You", "think", "we", "did", "this", "un", "thinkingly"] I can get as far as mystr.split(...
Concurrent control of generator and subroutine in Python Question: Function `bigop(init, report)` operates on a large dynamic internal data structure `data` derived from `init`, and accepts a callable `report(data)`. Function `status(data)` returns a summary of the current state of `data`. Function `bigop` calls `repo...
using output of scipy.interpolate.UnivariateSpline later in python or in Matlab without needing original datapoints Question: I'm using [`scipy.interpolate.UnivariateSpline`](http://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.UnivariateSpline.html) to smoothly interpolate a large amount of data. Work...
Does Python's main thread get garbage collected when it stops? Question: In a multi-threaded Python process I have a number of _non-daemon_ threads, by which I mean threads which keep the main process alive even after the main thread has exited / stopped. My non-daemon threads hold [weak references](http://docs.python...
Turning a python dict. to an excel sheet Question: I am having an issue with the below code. import urllib2 import csv from bs4 import BeautifulSoup soup = BeautifulSoup(urllib2.urlopen('http://www.ny.com/clubs/nightclubs/index.html').read()) clubs = [] trains = ["A","C","E","1","2","...
Response time for urllib in python Question: I want to get response time when I use `urllib`. I made below code, but it is more than response time. Can I get the time using `urllib` or have any other method? import urllib import datetime def main(): urllist = [ "http://go...
Interfacing C++ and Python using SWIG Question: I try to extend a Matrix class with SWIG to create a python interface. I used the official Docu code. But I get a totally ridiculous error message.. It seems to be unimportant where I declare my row class. I always get this error while compiling. What's wrong with SWIG? ...
How can I get the minimum and the maximum element of a list in python Question: If a have a list like: l = [1,2,3,4,5] and I want to have at the end min = 1 max = 5 WITHOUT `min(l)` and `max(l)`. Answer: Loop over the list and test each item against the minimum and max...
Python package seems to ignore my requirements Question: I created my first package. When I try to install it with pip in a newly created virtualenv I get an error indicating that libs cannot be imported, yet they are added to the `install_requires` field in `setup.py`. If I do it outside a vierualenv, all is ok. My se...
Accessing python container's parent object Question: I need to create a containers that can access its children but also its parent. Here is a simple example of how I was thinking to do that : import numpy as np import gc class Node(object): def __init__(self, name): ...
unable to import evernote.api.client (evernte sdk) Question: i'm trying to get started with evernote SDK , i'm using ubuntu 13.04 i installed the SDK via : pip install evernote but when i want to test it using : python -c 'from evernote.api.client import EvernoteClient' i got...
Reading an array in part from a file using Python Question: I have a file that looks like this: C 0.210991841737 0.047663662717 0.483960886619 C -0.960965312103 0.688519555303 -0.115848688934 C 1.558206749694 0.047460114159 -0.180267436891 O -0.8152...
Using regex to parse kindle "My Clippings.txt" file Question: I am currently trying to use python to parse the notes file for my kindle so that I can keep them more organized than the chronologically ordered list that the kindle automatically saves notes in. Unfortunately, I'm having trouble using regex to parse the fi...
Looking for OOP Pythonic approach for putting objects in a 'list object' as opposed to just using [list] Question: For some reason I cannot conceptualize how to use Checkbook.class object instead of "ledger [list]" Trying to keep my approach OOP. What is a best practices approach to the objectives of this code? (Yes, I...
How to convert dictionary values into list in Python / Django? Question: In my Django template, I call this frequently: {% for name, address in directory.addressbook.items %} {% for street in address.list %} {{street.number}} How do I create this as a filter? I've tried this, but it d...
python-sip: How to access a DLL from both Python and C++ Question: I have a C++ GUI, it load a DLL when running. I use SIP to import the DLL in python. I need to embed the python part in the GUI, and some data are needed to exchange between python and C++. For example, in the C++ GUI, I can enter command from a panel,...