text
stringlengths
226
34.5k
Python code for finding reverse average (finding possible value sets that give a certain average) Question: Background: I am working in Python 3, but if people provide answers in other programming languages I can still use it. Any suggestions on functions or efficient algorithm or programming tips would be helpful. Pr...
Embedding Python in C: Error when attempting to call Python code in a C callback called by Python code Question: I have some C code that calls a Python function. This Python function accepts an address and uses WINFUNCTYPE to eventually convert it to a function that Python can call. The C function send as a parameter t...
Python numpy index set from Boolean array Question: How do I transform a Boolean array into an iterable of indexes? E.g., import numpy as np import itertools as it x = np.array([1,0,1,1,0,0]) y = x > 0 retval = [i for i, y_i in enumerate(y) if y_i] Is there a nicer way? Answer: ...
Machine Learning Email Prioritization - Python Question: I have been working on a Python coded priority email inbox, with the ultimate aim of using a machine learning algorithm to label (or classify) a selection of emails as either important or un-important. I will begin with some background information and then move i...
Pass vector (float4) kernell argument to OpenCL (Python) Question: is there any easy way how to pass float4 or any other vector argument to OpenCL kernel? For scalar argument (int, float) you can pass it directly while calling kernel. For array argument you have to first copy it to GPU using cl.Buffer() and than pass p...
Why does this Python logical indexing take up so much memory Question: I have a 1-D time series that is 1e8 long (100,000,000 elements). [Here](https://www.dropbox.com/s/3eb6ywjzoo468rd/ch008.ddt) is a link to the data I am using on Dropbox. (The file is 382 MB.) **Update** Based on memory_profiling, the error occurs...
Ipython notebook crash using rmagic extension Question: I am trying to run the [rmagic functions extension](http://nbviewer.ipython.org/urls/raw.github.com/ipython/ipython/3607712653c66d63e0d7f13f073bde8c0f209ba8/docs/examples/notebooks/rmagic_extension.ipynb) example, but ipython crashes with console error message '\u...
plot many circles based on x,y,r being vectors in python Question: x,y are positions of the circles and r is the radius - all vectors.I want to plot them all at once. Something like: import matplotlib.pyplot as plt from matplotlib.patches Circle #define x,y,r vectors fig = plt.figur...
find all elements in a list of positive numbers that add up to number X Question: I'm trying to reverse engineer a legacy report and using python to solve the problem. The legacy report has an end sum number of 200,000. I know a collection of the numbers that could end up to this 200k, but this collection is littered...
How can I insert arrays into columns on a database table for my pyramid app? Question: I am trying to create an sql (sqlite) database where users upload an stl file and the data (all the points, triangles, ect.) is stored in a database so that it is permanently available. Is it possible to do this with a database with ...
Access python nested dictionary items via a list of keys Question: I have a complex dictionary structure which I would like to access via a list of keys to address the correct item. dataDict = { "a":{ "r": 1, "s": 2, "t": 3 }, "b":{ ...
Why don't nested sizers expand in wxPython if hidden at init? Question: I am trying to build a 3-panel GUI and everything was going great until I tried to nest panels/windows inside of other panels and hide them upon GUI startup. See this image... The yellow/green/blue boxes were automatically expanded to fill up thei...
Java NIO server and Python asyncore client Question: I have the following java NIO server and further below a python asyncore client. The server prints "Accepted...\n", however, the client's handle_connect is never called. Could someone help me with what's wrong with the server and help me connect to the server with th...
Switching kivy widgets Question: I am using the Kivy python library. I have two widgets defined. When the program runs, I run the first widget. When that widgets button is pressed, I want it to dissapear and be replaced with the second widget. Here is the .kv for the two widgets #uitest.kv <TestF...
Package and Module in Python for creating a Web App using Flask Question: Currently, I am in process of coding a web interface for a company. This web interface is based on python micro-framework Flask. I want to use MVC principle to build this interface. And I have some questions in mind. The model will contain the ...
Understanding PyDict_Check behaviour Question: I've been playing around with the Python C API for a while. I like it a lot but today I hit a roadblock. I have a Python extension that has a function which expects one or two dictionaries as argument. I fear I might have misunderstood how `PyDict_Check`, or `PyArg_ParseTu...
How to use relative imports in both, module and main Question: I have the following setup of a library in python: library | - __init__.py | - lib1.py | - ... | - tools | - __init__.py | - testlib1.py so in other words, the directory `library` contain ...
Python MySQL connection. Running on a Virtual Machine Question: I am trying to establish a connection to MySQL that is running locally using python. i use the following code import MySQLdb db = MySQLdb.connect("localhost","username","password","dbname") I am working on a virtual machine and I a...
Using mock library to patch a class method Question: I'm writing unit tests, and I need to mock a method call so that in most of the cases it behaved as method itself except when argument gets a special value 'insert into'. Here is a simplified production code: class CommandServer(object): def __...
Sums of entries, Python Question: > **Possible Duplicate:** > [summing up values of columns from multiple > files](http://stackoverflow.com/questions/14712268/summing-up-values-of- > columns-from-multiple-files) I have a small problem here, I'm trying to sum up entries from multiple files (50), and each of them con...
What is the fastest cache for small and rarely changing data to use with Django? Question: I am in a process of switching from PHP to Python + Django and looking for equivalent of PHP's "Array cache". For small data sets from DB like "categories" that was changing very rarely but accessed very often i was using array ...
PIL to Qimage conversion: QImage constructor does not free memory Question: I am developping a Qt application **loading** pictures with **PIL** , modifying colors and alpha channels, then **converting them as QImage**. Here is the problematic piece of code: normal **repeated usage of the ImageQt** function: ...
Enaml examples from Enthought not working with Python(x,y) Enthought Tool Suite version of Enaml Question: I recently discovered Enaml, a Python GUI development package from Enthought. I'm very interested in using it with Enthought Traits and Chaco for more rapid scientific application development. I've been using Pyth...
Looking for efficient python program for this following python script Question: I am looking for a memory efficient python script for the following script. The following script works well for smaller dimension but the dimension of the matrix is 5000X5000 in my actual calculation. Therefore, it takes very long time to f...
pub_date is invalid in Django tutorial error Question: C:\mysite>python manage.py shell Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from polls.models import Poll,Ch...
Read csv file from python Question: I had some data in excel file. I changed the file to .csv file and tried to write some python code to read the file. But I am getting some unpredictable outputs. My Code is like this: INPUT_DIR = os.path.join(os.getcwd(),"Input") OUTPUT_DIR = os.path.join(os.getcw...
Displaying current output in wx.textctrl wigdet from python code entered in another wx.textctrl Question: I use two wx.TextCtrl widgets in my wxApp. The first one is used to provide Python code by app user, e.g.: from time import sleep for i in range(4): print i sleep(4) ...
How to call Excel VBA functions and subs using Python win32com? Question: My Excel workbook contains VBA subs and macros similar to those below; they sit in Module1. How to call them using Python win32com module? Public Sub setA1(ByVal s As String) ThisWorkbook.ActiveSheet.Range("A1").Value = s ...
Python IDLE doesn't find text files unless I specify the path Question: In my Python books and also the Python Documents this code should be enough to open a file: f = open("file.txt", "r") But if I do this I will get an error message telling me file.txt doesn't exist. If I however use the whole pa...
How to get multiple parameters with same name from a URL in Pylons? Question: So unfortunately I find myself in the situation where I need to modify an existing Pylons application to handle URLs that provide multiple parameters with the same name. Something like the following... domain:port/action?c=1&v=3&c=4 Conventi...
Python getting next line following a certain Condition Question: I am trying to find a good way to return a value in a url page. I want that everytime "span class=" button" is listed I can grab the next line "span class=" button" 0.87 I want to get 0.87 I am trying: import ur...
Get pip to work with git and github repository Question: I'm writting a python app that depends on another one that is hosted on a github repository (never in pypi) for development reasons. Lets call them: * App being written: `AppA` * App in github: `AppB` In App A, the setup.py is like: # coding...
two for loops, second only executes on first iteration python Question: I am a python noob, and I am attempting to compare values between lines in two files and output the "line name" followed by a 1 if the line is in the second file and a 0 if the line is missing from the second file. The first iteration returns a 1, ...
How do you format this in Python?These are just 6 records as Json objects Question: I need to format this string.These are just 6 records of JSON arrays/objects.I need to write a python code to remove all `" ,`. I want to see only real data in a single row. Can someone help me with the code?I have a deadline for this....
SEGUID from python to c++ Question: I'm trying to do this in C++, I have some code in Python but I can't figure how to make it work in C++ def seguid(seq): try: #Python 2.5 sha1 is in hashlib import hashlib m = hashlib.sha1() except: #F...
post request using python to asp.net page Question: i want scrap the PINCODEs from "<http://www.indiapost.gov.in/pin/>", i am doing with following code written. import urllib import urllib2 headers = { 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 'Or...
Python Different the datetime in a Struct Array Question: import struct from collections import namedtuple StructDeviceInfo = namedtuple('DeviceInfo', ['DeviceID', 'Capturing','Receiving','Socket','DateTime']) DeviceInfoList = [] def threaded_function(): while True: if...
Generate a set of sorted random numbers from a specific range Question: I'd like to generate a set of x unique random numbers and sort them in Python. For example: range(1000, 10000) x = 100 I've figured out to import random and use the random.randrange method, then loop to get 100 random numbers and in the end sort t...
gevent.http.HTTPServer API suggests streaming, but instead buffers entire requests and responses Question: The APIs offered by `gevent.http.HTTPServer` would seem to support streaming in both directions. The request object does not offer the request body as a simple string, but instead provides an `.input_buffer` attri...
Unpacking iterable into other iterable? Question: While reading data from a ASCII file, I find myself doing something like this: (a, b, c1, c2, c3, d, e, f1, f2) = (float(x) for x in line.strip().split()) c = (c1, c2, c3) f = (f1, f2) If I have a determinate number of elements per line (whi...
Why are uncompiled, repeatedly used regexes so much slower in Python 3? Question: When answering [this question](http://stackoverflow.com/q/14755882/20670) (and having read [this answer](http://stackoverflow.com/a/452143/20670) to a similar question), I thought that I knew how Python caches regexes. But then I thought...
Connect MySQl with Python Error : function 'inet_pton' not found Question: import mysql.connector cnx = mysql.connector.connect(user=user, password=password,host=host,database=database) cursor = cnx.cursor() add_employee = ("INSERT INTO tbl_gps " "(Locating, MainPower, Acc, Pow...
I'm looking for tutorial in web-crawlers Question: I need to learn more about web-crawlers for a personal project of mine, and I'd like to have some questions answered: 1) By what I've heard, it seems like Google uses python for his web-crawlers, is that right? 2) Following that question, would you say that it is a g...
Python multiple file transfer over TCP sockets Question: I am trying to write a program in python to transfer multiple files in a folder over a socket, I have the following code so far Client: def uploadFiles(folder,dcip,PORT,filetype): os.chdir(folder) dirList = os.listdir(folder) ...
Can't get a sensible result with libreplaygain.so and numpy Question: I've been trying over and over again to use `libreplaygain.so` (`ReplayGain` is an algorithm for calculating loudness of audio. ) from python, passing it data from an audio file. Here is [the header file](http://sourcecodebrowser.com/libreplaygain/1....
Feasibility of using pipe for ruby-python communication Question: Currently, I have two programs, one running on Ruby and the other in Python. I need to read a file in Ruby but I need first a library written in Python to parse the file. Currently, I use XMLRPC to have the two programs communicate. Porting the Python li...
How to define list of int and defaultdict Question: I want to define a list of an integer and defaultdict in python. I am creating a parent dictionary which shall return the above list. I am being unable to define the list type. def index_struct():return defaultdict(list_struct) def list_struct(): r...
Sobel operator - Open Cv Python Question: Img is my input image which is in RGB import cv2 import numpy as np img = cv2.imread("Lenna.png") black = cv2.cvtColor(img , cv2.cv.CV_BGR2GRAY) Now I would want to apply a sobel operator to it using filter2D sobel = np.array([[-1...
python ctypes pragma pack for byte aligned read Question: I have a C++ application with below structure written to file. Now I need to unmarshal them using python, The basic problem here is how to reflect the `pragma pack` option in python. C++ Structure #pragma pack(1) struct abc { unsi...
How do I make the program wait for an input using an Entry box in Python GUI? Question: This is the code for the function I'm using to start the main part of the program, however I want some sort of loop or something which creates ten questions, but waits for an input from the Entry box before moving onto the next ques...
Python json.loads doesn't work Question: I've been trying to figure out how to load JSON objects in Python. def do_POST(self): length = int(self.headers['Content-Length']) decData = str(self.rfile.read(length)) print decData, type(decData) "{'name' : 'journal2'}" <type ...
How to split a pdf document containing multiple logical pages on each sheet? Question: I want to split a 2x2 pdf document into its original pages. Each page consists of four logical pages which are arranged like in [this](http://rainnic.altervista.org/sites/default/files/styles/large/public/images/4_slide_orizzontali_2...
Python - Splitting List That Contains Strings and Integers Question: myList = [ 4,'a', 'b', 'c', 1 'd', 3] how to split this list into two list that one contains strings and other contains integers in _elegant/pythonic_ way? output: myStrList = [ 'a', 'b', 'c', 'd' ] myIntList = [ 4,...
ipython %run testscript_in_pythonpath.py returns "no file found" error Question: I would like to use the %run magic command to run a script in a directory which is in the pythonpath variable. The script reads some files in the working directory. However, when I try to run the script using the command: %run "testscript_...
General map operation in C Question: how can i define a general map operation on an array in C? ideally I want something like python's map(function,array) ~~ but as a macro. I believe this would be something like C++'s std::transform, but would be in C, and not use iterators.. (this would be unary operation) I was th...
IndentationError message Django Question: I am working with Django 1.4.2 and I got the following error message: ![enter image description here](http://i.stack.imgur.com/dQzCG.png) Can someone tell me which files are having the indent problem? I tried `python -m tabnanny -v manage.py` and I got "Clean bill of health" s...
Monkeyrunner doesn't touch webview Question: I need to test android app which includes WebView with buttons. Monkeyrunner works fine for all parts of the app except WebView. Button in WebView just ignores touches from Monkeyrunner. I see that button is clicked because it became grey but then button does nothing. If I ...
flickrAPI groups_leave() gives error Question: I keep getting an `<Element 'rsp' at 0x2f25830> Error: 99: Insufficient permissions. Method requires delete privileges; write granted.` error when I try to run `groups_leave()` from FlickrAPI. I use the `people_getGroups()` and it runs like a champ, so I used the same cod...
How can I make jenkins run "pip install"? Question: I have a git repo and would like to get jenkins to clone it then run virtualenv venv --distribute /bin/bash venv/source/activate pip install -r requirements.txt python tests.py The console output from jenkins is: + virtu...
Python evernote api Error Question: Trying to build app that connects with Evernote API, in Python/Django. For the below code i get the following error message: " 'Store' object has no attribute 'NoteFilter' " from <http://dev.evernote.com/documentation/reference/NoteStore.html#Svc_NoteStore> One can see, that NoteFilt...
Error when connecting to Google Mail over SMTP using smtplib in Python Question: My issue is that when I run the following code, I get a WinError 10061, and from all of my searching it looks like this is a result of the foreign machine not being set up properly, but I assume that Google has that taken care of for gmail...
Python Error while using Google Apps Engine Question: I am hosting a website on Google Apps Engine and am trying to use Python's mail API to take POST data and send an email. Here is my script: from google.appengine.ext import webapp from google.appengine.ext.webapp.util import run_wsgi_app from...
Parsing yaml python Question: There is a file in yaml markup a: b:x test2 test test3 How to use python (2.7.x) and PyYAML get x? Answer: You can't! The YAML you posted results in a dict containing just a single key, `a` which maps to the value `"b:x test2 test test3"` \- ...
How to generate a new table in PostgreSQL by iterating over an existing table of OSM data Question: I have a PostgreSQL database made up of the OSM map data for London. I imported this data using osm2psql. I would like to: * Iterate over every line in the planet_osm_line table * Break up the lines into individual...
How can I search sub-folders using glob.glob module in Python? Question: I want to open a series of subfolders in a folder and find some text files and print some lines of the text files. I am using this: configfiles = glob.glob('C:/Users/sam/Desktop/file1/*.txt") But this cannot access the subfold...
*.pyc files not being found Question: I'm writing an application that loads byte-compiled `*.pyc` files under Python 3.3. I am distributing the `*.pyc` files without their corresponding `*.py` files to (try to) protect my source code. (Yes, as noted [here](http://stackoverflow.com/questions/11368304/what-are-the-limita...
Structuring Data in Python (list from lists?) Question: I'm currently developing a script in Python 2.7 which pulls approximately 50 string values from a URL and places these values in a list. For each of these 50 values, they each have a further respective 20 associated string values. So for example, I may capture t...
generating list for joint distribution Question: I'm pretty sure this is an easy problem but I am completely blacking out on how to fix this. I am trying to work my way through the PGM class on coursera and it starts of with joint probability distribution. So I am trying to generate a list of all possible distributions...
Python module dependencies Question: I'm trying to make my own module for easy sprite rendering & creation for personal uses. The only problem is, it needs pygame. If I were to put `import pygame` at the top of my module, could I then in another program, setup pygame instead of setting it up in the module? In general, ...
Loading JSON object with special values as a string Question: I'm trying to create a string JSON object to load using the `json` module; however, I'm having some trouble since some of my values are the python `True` and `False` rather than unicode strings. For example, I want do the following: >>> newDic...
Python int to percent Question: I need monthlyPayment as percentage so instead of range = [4, 5, 6, 7, 8] I need range = [0.04, 0.05, 0.06, 0.07, 0.08] Do you know how to do it, and still get the calculation from totalPayment import math loanAmt=int(input("Enter the Amount (greater then 0) of ...
Input datatype error Question: I have a program which takes a string and converts it into list which looks like this - `['CTTC', 'CGCT', 'TTTA', 'CATG']`. (its actually a lot longer than this). Now I need to find how many of these list elements have a `C or A or T or G` as its 1st letter. This needs to be taken from th...
Python: KeyError 'shift' Question: I am new to Python and try to modify a pair trading script that I found here: <https://github.com/quantopian/zipline/blob/master/zipline/examples/pairtrade.py> The original script is designed to use only prices. I would like to use returns to fit my models and price for invested quan...
Why does easy install want access to my rootfs for a "develop" install? Question: I'm looking at a python application server and I wanted to play around with the code. I'm lead to believe passing "develop" to setup.py should leave everything in place without installing anything. However when running so it is attempting...
Python - Print a value without intterupting a loop/function Question: Using Python 2.7 on Windows 7. I has a recursive function, to find a file in the path, also looking in the sub-folders. **My Problem:** During long searches, I wish to see the value of `retval` on `KeyboardInterrupt`. But the code is raising an...
Using Python help throws SEGFAULT Question: While using Python help I typed modules and got the following error: help> modules Please wait a moment while I gather a list of all available modules... /usr/lib/python2.7/dist-packages/gobject/constants.py:24: Warning: g_boxed_type_registe...
Convert text prediction script [Markov Chain] from javascript to python Question: i've been trying the last couple days to convert [this js script](http://blog.javascriptroom.com/2013/01/21/markov-chains/) to python code. My implementation (blindfull cp mostly, some minor fixes here and there) so far: i...
Using buttons in Tkinter to navigate to different pages of the application? Question: I have quite a simple question here. In Tkinter (python), i was wondering who to use a button to go to different pages of my application, e.g a register page, and a login page. I am aware that GUI does not have 'pages' like websites d...
multiple users doing form submission with python CGI Question: I have a simple cgi script in python collecting a value from form fields submitted through post. After collecting this, iam dumping these values to a single text file. Now, when multiple users submit at the same time, how do we go about it? In C\C++ we us...
My form is called twice but why? Question: When I try to save my form i meet this error : Exception Value: Cannot assign None: "TriggerService.user" does not allow null values. Exception Location: /usr/local/lib/python2.6/dist-packages/django/db/models/fields/related.py in __set...
Convert CSV to txt and start new line every 10 values using Python Question: I have a csv file with an array of values 324 rows and 495 columns. All the values for each row and col are the same. I need to have this array split up so that every 10 values is put in a new row. So for each of the 324 rows, there will be 4...
Unable to get ToMany to work in Tastypie Question: I'm following the Tastypie docs, and have found myself utterly stuck. I have the following: API: class ProjectResource(ModelResource): milestones = fields.ToManyField('ProjectTrackerServer.projects.api.MilestoneResource', 'projects', related_nam...
Using ipcluster to connect to an OS X server w/ EPD from Linux? Question: I am trying to use IPython.parallel's support for SSH to allow my Linux client to run remote `ipengine`s from an OS X server that has EPD64 installed. This fails, however, as it attempts to use my local machine to figure out the right command to ...
convert python dataframe to list Question: I have a Python dataFrame with multiple columns. LogBlk Page BayFail 0 0 [0, 1, 8, 9] 1 16 [0, 1, 4, 5, 6, 8, 9, 12, 13, 14] 2 ...
Parsing XML with LXML and Python Question: I have the following XML: <nfl> <season season="2012"/> <conference label="AFC"> <division label="Eastern Division"> <team city="Buffalo" name="Bills" alias="Buf" /> <team city="Miami" name="Dolphins" alias="Mia"...
Python CSV writer with utf-8 code formats Question: I am trying to write something in Dutch to a CSV a file and this is what happens In the following program, ideally, "Eéntalige affiche in Halle !!" should be written in the csv file. However, it's writing "Eéntalige affiche in Halle !!" # -*- encoding...
How to print a specific xml value using python? Question: I have the xml which looks like below <api> <apicat> <cat> <id>1</id> <name>testname</name> </cat> <cat> <id>2</id> <name>testname2</name> </cat> <cat> ...
Create for loop for naming output file Python Question: So i'm importing a list of names e.g. Textfile would include: Eleen Josh Robert Nastaran Miles my_list = ['Eleen','Josh','Robert','Nastaran','Miles'] Then i'm assigning each name to a list and I want to write a new ex...
Python using re module to parse an imported text file Question: def regexread(): import re result = '' savefileagain = open('sliceeverfile3.txt','w') #text=open('emeverslicefile4.txt','r') text='09,11,14,34,44,10,11, 27886637, 0\n561, Tue, 5,Feb,2013, 06,25,31,...
Can't get OpenCV to work with Python on a Mac Question: I am having trouble getting OpenCV to work with Python on my Mac. I have tried installing it with MacPorts and with Cmake (which I installed from MacPorts) using the methods found at here: <http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port>. I also had to ...
Cant add image to Tkinter Listbox Question: I'm trying to add an image to a Listbox, but instead of the image I see an entry called "pyimage1" in the Listbox. I've successfully displayed images using the Text and Label widgets, but I can't figure out the Listbox widget. I checked the documentation but it doesn't indic...
list intersection algorithm implementation only using python lists (not sets) Question: I've been trying to write down a list intersection algorithm in python that takes care of repetitions. I'm a newbie to python and programming so forgive me if this sounds inefficient, but I couldn't come up with anything else. Here,...
Modifying logging message format based on message logging level in Python3 Question: I asked this question for python 2 [here](http://stackoverflow.com/questions/1343227/can-pythons-logging-format- be-modified-depending-on-the-message-log-level), but bumped into the issue again when the the answer no longer worked for ...
whitespaces in the path of windows filepath Question: I am working on file operations using python. I have a filepath as : filepath = "E:/ABC/SEM 2/testfiles/all.txt" when I am opening the file using python, it says me : IOError: No such file: but, the file is present on the d...
About handling a redirection in python Question: I am new to python and am trying to learn some new modules. Fortunately or unfortunately, I picked up the urllib2 module and started using it with one URL that's causing me problems. To begin with, I created the Request object and then called Read() on the response obje...
Python - Parse float string to an integer Question: I want to convert a string like "0.75" into 3/4. Do python has any builtin function for this. I know i can convert it using float("0.75") to get a float value. But I need only integer number without loosing resolution. I can write a function like multiplying it by 1...
Importing Sets in python Question: When I am trying to use sets it's showing that there is nothing named set. from sets import set > ImportError: cannot import name set How do I fix it? Answer: You don't _need_ to import the [`sets` module](http://docs.python.org/2/library/sets.html); se...
inheriting numpy.vectorize-ed functions Question: While hunting down an obscure bug, I've stumbled onto something best demonstrated by this minimal example: import numpy as np class First(object): def __init__(self): self.vF = np.vectorize(self.F) print "First: vF...
Append several variables to a list in Python Question: I want to append several variables to a list. The number of variables varies. All variables start with "volume". I was thinking maybe a wildcard or something would do it. But I couldn't find anything like this. Any ideas how to solve this? Note in this example it i...
How do I correctly close a pipe shared by two processes? Question: I'm attempting to use pipes to communicate between processes in python. These processes will be called from different threads, and so may not have direct access to the `Popen` object for each process. I've written script below, as a simple proof of conc...