text stringlengths 226 34.5k |
|---|
433MHz Sender and Receiver in Python on Raspberry PI
Question: Is there any way to get a working 433MHz-Sender or -Receiver in a Python
Thread?
I have tried those from Ninjablocks and those from Adafruit. But the Problem
is that these are all c or c++ scripts, that are outputting to stdout and have
no end of the outpu... |
How can I add new methods to a COM server that I have already registered?
Question: **EDIT** : turns out VBA can see the new methods if I restart Excel. My
question still stands, though, albeit in a different form: how can I force
Excel to see the new methods without restarting it?
I have a simple COM server that look... |
python code returns none type object has no attribute error sometimes and works perfectly the other time
Question:
def dcrawl(link):
#importing the req. libraries & modules
from bs4 import BeautifulSoup
import urllib
#fetching the document
op = urllib.FancyURLopener({})... |
R's read.table equivalent in Python
Question: I'm trying to move some of my processing work from R to Python. In R, I use
read.table() to read REALLY messy CSV files and it automagically splits the
records in the correct format. E.g.
391788,"HP Deskjet 3050 scanner always seems to break","<p>I'm running ... |
Filling a strange webform in python
Question: I am trying build a simple program that fills a webform and then extracts the
a data from the resulted website, it should be pretty straight-forward and
after a short web research (mostly from this website) I came to the conclusion
that python would be my best choice.(with ... |
AttributeError: 'NoneType' object has no attribute 'lower' python
Question: My abc.txtfile looks like this
Mary Kom 28 F
Emon Chatterje 32 M
Sunil Singh 35 M
Now i am getting the desired result with the following traceback:Please help
me out. I am not getting where am i going ... |
Deterministic and non uniform long string generation from seed
Question: I had this weird idea for an encryption that I wanted to try out, it may be
bad, and it may have done before, but I'm just doing it for fun. The short
version of the question is: Is it possible to generate a long, deterministic
and non-uniformly d... |
In SWIG , how can i use int * variable without typemaps.i
Question: I have a program where in a C function somewhat like below code. When i try to
call this function via python it it throwing error saying
argument 2 of type 'int *'. In swig i saw there is way to handle this that is
via typemaps is there any other way ... |
Error in hierarchical clustering with hcluster in python
Question: I am trying to ran the following code, and I get an AttributeError: 'module'
object has no attribute 'hcluster', raised in the last line.
I am running in Mountain Lion, I use pip and homebrew, and hcluster is in
PYTHONPATH=/usr/local/lib/python2.7/site... |
Removing duplicates and preserving order when elements inside the list is list itself
Question: I have a following problem while trying to do some nodal analysis:
For example:
my_list=[[1,2,3,1],[2,3,1,2],[3,2,1,3]]
I want to write a function that treats the element_list inside my_list in a
follow... |
Using httplib to connect to a website in Python
Question: tl;dr: Used the httplib to create a connection to a site. I failed, I'd love
some guidance!
I've ran into some trouble. Read about socket and httplib of python's, altough
I have some problems with the syntax, it seems.
Here is it:
connection = h... |
Trying to get code to output multiple columns in Python
Question: I am importing a data set and trying to output some text analysis. However, I
can only get it to output the last column of data. Where do I put the
csv.writer in order to get all the lines of code in?
from __future__ import division
im... |
Decrypt using an RSA public key with PyCrypto
Question: As far as I understand, I should be able to use RSA to ensure authenticity or
privacy, as I wish. In my case, I want to ensure authenticity so I encrypt the
data with the private key and allow anyone to decrypt it with the public key.
The data is not really secret... |
My character won't move in python
Question: This is the code I used.
import pygame, sys
from pygame.locals import *
pygame.init()
def game():
width, height = 1000, 600
screen = pygame.display.set_mode((width,height))
pygame.display.set_caption('My game far now ... |
How to modify Jinja templates for nbconvert?
Question: I am trying to find alternate ways to display my IPython Notebooks.
What I am currently doing is modifying the Jinja templates found here
(C:\Anaconda\Lib\site-
packages\ipython-1.1.0-py2.7.egg\IPython\nbconvert\templates) and then simply
using the nbconvert comma... |
select a random range of curves within current selection
Question: I am an absolute novice, but have a feeling this is an easy thing for someone
who knows python.
Basically I have a group of nurbs curves selected, and what I want to do is
randomize the selection with a specified range. For instance from a list of
100 ... |
Python and multiple select with a ListCtrl
Question: I have a custom listctrl in my application that I would like the ability to
select multiple rows (and deselect) much like one would do in a ListBox.
Currently I have a listctrl that I am able to grab single selections; however,
once I click on another row in my listc... |
scikitlearn breaks pandas installation
Question: I have a problem having pandas and sklearn work together. Importing any module
from sklearn, makes pandas run havoc.
This is a minimal example of my problem:
#!/usr/bin/env python
import pandas as pd
import sklearn.metrics as sk
df_train ... |
Python xml.etree.ElemenTree, getting HTML entities
Question: I am trying to analyze xml data, and encountered an issue with regard to HTML
entities when I use
import xml.etree.ElementTree as ET
tree = ET.parse(my_xml_file)
root = tree.getroot()
for regex_rule in root.findall('.//regex_rule'):... |
Sort an array of tuples by product in python
Question: I have an array of 3-tuples and I want to sort them in order of decreasing
product of the elements of each tuple in Python. So, for example, given the
array
> [(3,2,3), (2,2,2), (6,4,1)]
since 3*2*3 = 18, 2*2*2 = 8, 6*4*1 = 24, the final result would be
> [(6,4,... |
Keeping to 79 char line limit in Python with multiple indents
Question: I understand that to write good Python code, I should keep my lines to no more
than 79 characters.
This is fine most of the time, but if I have various nested for loops and if
statements themselves nested within a class, I might easily find that I... |
how to store html form data into file
Question: My HTML code:
<html>
<head>
<title>INFORMATION</title>
</head>
<body>
<form action = "/cgi-bin/test.py" method = "post">
FirstName:
<input type = "text" name = "firstname" /><br>
LastName:
... |
PyMongo not working in Django Eclipse
Question: I am trying to integrate MongoDB in my Django Project. For this I have
installed Mongo and PyMongo in my Mac system and everything looks fine. I
tried executing some PyMongo code in python shell and it worked fine.
But when I try to `from pymongo import Connection` in my... |
Gevent: NotImplementedError
Question: Why is gevent throwing this error? Running it in ipython, ubuntu 13
In [1]: from gevent import monkey
In [2]: monkey.patch_all()
In [3]: The history saving thread hit an unexpected error (NotImplementedError('gevent is only usable from a single thre... |
How to input a list of tuples
Question: I am coding a python program related to graphs.
My main is like this
if __name__=='__main__':
cns = [(0,1), (0,2),(1,2), (1,3),(3,1)]
G=make_graph(cns)
r=DFS(G)
I want to change the program such that the user can input the data.
... |
Why does the collide happen many times?
Question: I'm using openGL with Pyglet which is a python package. I have to use this
language and this package, it is for an assignment. I have a basic
Brickbreaker style game that is basically a keep it up game.
I create a ball and a paddle.
I separately create a bounding box ... |
Scope of function inside the function (understanding recursion)
Question: What is the scope of the function itself inside the function in python? My
question arises because I finally thought about venturing into recursion (
though I am not competent enough to understand it fully). I am using Eclipse
(PyDev) and inside ... |
Import csv as list of list in python 3.3
Question: i hav a list of list with 2 strings and 1 integer
list_of_ee = [["a","m",15],["w","p",34]]
i export this to csv file using this code.
import csv
myfile = open("pppp.csv", 'wb')
with open("pppp.csv", "w",newline='') as my... |
Performance bottleneck in creating network with igraph in Python
Question: I am trying to create a huge network using the igraph python module. I am
iterating trough a list of dictionaries in the following format:
d1={'el1':2, 'el3':4, ...,'el12':32}
d2={'el3':5, 'el4':6, ...,'el12':21}
The net... |
datetime.date creating many problems with set_index, groupby, and apply in Pandas 0.8.1
Question: I'm using Pandas 0.8.1 in an environment where it is not possible to upgrade
for bureaucratic reasons.
You may want to skip down to the "simplified problem" section below, before
reading all about the initial problem and ... |
Python Beautiful Soup parsing a UTF-8 coded table (using mechanize)
Question: I'm trying to parse the following table, coded in UTF-8 (this is part of it):
<table cellspacing="0" cellpadding="3" border="0" id="ctl00_SPWebPartManager1_g_c001c0d9_0cb8_4b0f_b75a_7cc3b6f7d790_ctl00_HistoryData1_gridHistoryDa... |
Rules from accented letters to ascii ones
Question: Is there a rule that helps to find the UTF-8 codes of all accented letters
associated to an ascii one ? For example, can I have all the UTF-8 codes all
the accented letters `é`, `è`,... from the UTF-8 code of the letter `e`?
## Here is a showcase in Python 3 using th... |
Gtk MenuBar kills MenuItems after the pointer hovers over them
Question: I have a plain `gtk.MenuBar` frame below. Whenever the mouse hovers over an
item, and that submenu is hidden due to lost focus, upon revisiting that
submenu, all items are lost.
The expected behavior is that the menu items re-appear in the order ... |
Is there a way to clear your printed text in python?
Question: Hello guys I have wanted for a long time to find out how to clear something
like print("example") in python, but I cant seem to find anyway or figure
anything out.
print("Hey")
>Hey
Now I need to clear it, and write some new text.
... |
How to send a stream with python fabric
Question: I need to send the stdout stream of a program across a network, to the stdin
of another program, running on another host.
This can be easily accomplished using ssh:
program 1 | ssh host 'program 2'
It's trivial to call this using `subprocess`:
... |
Python lib execute error
Question: I made this python lib and it had this function with uses urllib and urllib2
but when i execute the lib's functions from python shell i get this error
>>> from sabermanlib import geturl
>>> geturl("roblox.com","ggg.html")
Traceback (most recent call last):
... |
Play video using libVLC from memory in python
Question: I am trying to make use of libVLC python bindings to play files after reading
them into memory. I have the following code that reads a valid video file into
the memory. I need to now play the video directly from the memory.
import vlc
File1 = op... |
python: avoiding zip truncation of list
Question: I have the following python code that uses zip() and it seems to cause
unintended data truncation.
inc_data = [[u'Period Ending', u'Dec 31, 2012', u'Dec 31, 2011', u'Dec 31, 2010'],
[u'Total Revenue\n', u'104,507,100\n', u'106,916,100\n', ... |
python structure JSON serializing issue
Question: I've got a cache dictionary that stores a 3-element list for each key:
`[value, date_created, hits]`. The cache communication is done via JSON. There
is a `items` command in the cache that shall return all items. This is the set
cache method:
@status
... |
Excel fails to open Python-generated CSV files
Question: I have many Python scripts that output CSV files. It is occasionally
convenient to open these files in Excel. After installing OS X Mavericks,
Excel no longer opens these files properly: Excel doesn't parse the files and
it duplicates the rows of the file until i... |
interpolate python array to minimize maximum difference between elements
Question: What is a concise and readable way of interpolating a 1D array such that the
maximum difference between elements is minimized?
For instance, if I had the array [4 9 13 25] and I was allowed to add 1 more
number in order to minimize the ... |
Pandas MultiIndex names not working
Question: The `axis 0` in the `IndexError` strikes me as odd. Where is my mistake?
It works if I do not rename the columns before setting the MultiIndex
(uncomment line `df = df.set_index([0, 1])` and comment the three above).
Tested with stable and dev versions.
I am fairly new to... |
Python multiprocessing EOF error on csv files
Question: I am trying to implement a
[multiprocessing](http://docs.python.org/library/multiprocessing.html)
approach for reading and comparing two csv files. To get me started, I started
with the code example from [embarassingly parallel
problems](http://stackoverflow.com/q... |
Using XHR to update a server file and add option to html select
Question: I am trying to have the input field add text into a file that is on the server
and add it to the select element on the webpage dynamically but it is not
working out so well. Currently I am getting an error that e1 is null and the
text is not gett... |
Heavily confused by win32api + COM and an answer from SO
Question: From my other question here on SO, I asked how to retrieve the current playing
song from Windows Media Player and Zune, I got an answer from a c++ dev who
gave me an explanation of how I would do this for WMP.
However, I am no C++ dev, nor am I very ex... |
Python: Non-Responsive multiprocessing.pool.map_async() function
Question: I have a strange problem here.
I have a python program that executes code held in seperate .py files,
designed to be executed in sequence, one after another. The codes work fine,
however they take too long to run. My plan was to split up proces... |
add title to collection of pandas hist plots
Question: I'm looking for advice on how to show a title at the top of a collection of
histogram plots that have been generated by a pandas df.hist() command. For
instance, in the histogram figure block generated by the code below I'd like
to place a general title (e.g. 'My c... |
Is there a good way to avoid memory deep copy or to reduce time spent in multiprocessing?
Question: I am making a memory-based real-time calculation module of "Big data" using
Pandas module of the Python environment.
So response time is the quality of this module and very critical and
important.
To process large data... |
"NameError: Can't find file for module maya" while trying to run a Python script in Eclipse
Question: I setup Eclipse IDE for editing and debugging Maya scripts. When I try to run
the code:
import maya.cmds as cmds
cmds.ls()
in Eclipse I get the error:
import maya.cmds as cmd... |
How to use AES with GAE python?
Question: I would like to encrypt the data transferred between GAE app and my android
application (_https_ will not help since the key should be dynamic). I am
thinking about AES (128-bit) encryption.
I've tried to use `pycrypto` (GAE SDK 1.8.6, python 2.7, OS X 10.9):
li... |
Find lowest value in a list of dictionaries in python
Question: I want to find and return the minimal value of an id in a string, for example:
find_min_id([{"nonid": "-222", "id": 0}, {"id": -101}])
-101
find_min_id([{’id’: 63, 'id': 42}])
42
So far I have this:
def find_... |
Drawing Circles Python
Question: The function is supposed to loop, each time decreasing the size of the circle
by 10 and drawing a new circle, until the size is less than or equal to 0.
What am i missing
def circle(x):
turtle.up()
turtle.goto(0,0)
turtle.down()
turtle.colo... |
Dynamically naming edited csv, to include part of the old csv name
Question: I am using some code to merge two csvs and sort these by two columns.
Ouputting a new csv. The input csvs are of the same name just numbered 1 & 2\.
I am repeating this code for multiple sets of data. I was wondering what the
method would be t... |
write csv row (from within for loop) out to csv file without using python csv module
Question: **My goal is to avoid importing the csv module
I am working on a script that runs through an extremely large csv file and
selectively writes rows to a new csv file.
I have the following two lines:
with open(s... |
Python xticks in subplots
Question: If I plot a single imshow plot I can use
fig, ax = plt.subplots()
ax.imshow(data)
plt.xticks( [4, 14, 24], [5, 15, 25] )
to replace my xtick labels.
Now, I am plotting 12 imshow plots using
f, axarr = plt.subplots(4, 3)
axarr[i, j].im... |
Python 'requests' module and encoding?
Question: I am doing a simple POST request using the requests module, and testing it
against [httpbin](http://httpbin.org/)
import requests
url = 'http://httpbin.org/post'
params = {'apikey':'666666'}
sample = {'sample': open('test.bin', 'r... |
Weird segmentation fault in python3 after updated to MAC OS X Mavericks
Question: I've updated my system to OS X Mavericks, just now when I tried to use hashlib
module a strange Segmentation fault Raised. I've tried to rebuild the
python3.3.2 and reinstall it again but it didn't help. So how could I fix this
annoying p... |
inspect.getsource() doesn't work in python
Question: I have a problem with this code , but don't no why...
import inspect
inspect.getsource(min)
and the error is:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
inspect.getsource(min)
... |
accessing ctypes returned object's methods
Question: I need to wrap c++ dll to python. I'm using `ctypes` module for that.
c++ header is something like:
class NativeObj
{
void func();
}
extern "C"
{
NativeObj* createNativeObj();
}; //extern "C"
I want... |
Python doesn't allow me to do match.group() with regex?
Question: I wrote a regex in Python to just get the digits from a string. However, when
I run match.group(), it says that the object `list` has no attribute `group`.
What am I doing wrong? My code as typed pasted into the terminal, and the
terminal's response. Tha... |
Python BeautifulSoup Print Info in CSV
Question: I can print the information I am pulling from a site with no problem. But when
I try to place the street names in one column and the zipcodes into another
column into a CSV file that is when I run into problems. All I get in the CSV
is the two column names and every thin... |
Python Tkinter listbox with MySQLdb
Question: It's my first program in python and I'm trying to create a program that will
interface a MySql address book with a asterisk server and make a call. The
"asterisk code part" is ok, I will add later, but the problem is that I have a
listbox in Tkinter and I would like to fill... |
Execute another ipython notebook in a separate namespace
Question: I've been using some very nice code from [this
example](http://nbviewer.ipython.org/5491090/analysis.ipynb) to run one
ipython notebook from another, which I (basically) copy below. This turns out
to be a very nice way to organize my code.
But now, I w... |
XSLT 2.0: Creating child elements from an element's text value via known semantic hierarchy
Question: A bit stuck on this one. Data is provided in the following format (non-
important content snipped):
<?xml version="1.0" encoding="UTF-8"?>
<Content Type="Statutes">
<Indexes>
<!--SNIP--... |
Numba autojit error on comparing numpy arrays
Question: When I compare two numpy arrays inside my function I get an error saying only
length-1 arrays can be converted to Python scalars:
from numpy.random import rand
from numba import autojit
@autojit
def myFun():
a = rand(10,1)
... |
Unpickling from converted string in python/numpy
Question: I have a ton of numpy ndarrays that are stored picked to strings. That may
have been a poor design choice but it's what I did, and now the picked strings
seem to have been converted or something along the way, when I try to unpickle
I notice they are of type `s... |
read a file into python and remove values
Question: I have the following code that reads in a file and stores the values into a
list. It also reads each line of the file and if it sees a '(' in the file it
splits it and everything that follows it on the line.
with open('filename', 'r') as f:
lis... |
How do I force scatter points real pixel values when plotting in pyplot/python?
Question: I've taken an image and extracted some features from it using OpenCv. I'd like
to replot those points and their respective areas (which are real pixel
values) into a scatter window and then save it. Unfortunately, when I plot the
... |
Trigger a Python function exactly on the minute
Question: I have a function that I want to trigger at every turn of the minute — at 00
seconds. It fires off a packet over the air to a dumb display that will be
mounted on the wall.
I know I can brute force it with a while loop but that seems a bit harsh.
I have tried ... |
Scraping Multiple Tables with Beautiful Soup
Question: I'm a python newbie trying to scrape tables with Beautiful Soup.
I want to scrape tables similar to the one below with Ubuntu CVE information
and output the table to a csv document.
<div class="pkg">
<div class="field">Package</div><div class="v... |
Python - spaces
Question: I can't get over this little problem.

The second is right.
How can i print without spaces?
def square(n):
for i in range(n):
for j in range(n):
if i==0 or j==0 or i==n-1 or... |
sqrt() argument after * must be a sequence
Question: First of all, I'm super new to python and I actually search for my problem but
the examples were to heavy to understand.
Here is my homework; I need a function which takes two functions as an
argument and returns if the results of the two functions are same or not?
... |
Loop through every character in a sentence in python
Question: So I need to loop through a sentence character by character and total up the
different letters and how many times they occur. I can't think of a way of
doing the first bit (I'll do the totalling up myself I have a good enough idea
and I'd like to see if I c... |
Fading Text in Python Turtle
Question: Is there anyway to fade a text for showing and hiding. Or clear part of screen
without cleaning other drawings.
import turtle
#fade this text
turtle.write("Hello")
#clear some shape
turtle.fd(100)
Answer: There is no function to fade text and ... |
Python - TypeError: Can't convert 'int' object to str implicitly
Question: I try to write to a file but python gives me an error.
f.write('20/10/2013;SP;83428407;10:00;-;10:30;'.format(random.randrange(0,6))+';'.format(random.randrange(0,6))+';:00:15;:03:12;;;0;2;:00:58;50,0;2;0;0;0;0;0;0;0;0;0'+'\n')
... |
Comparing list in python
Question: Hey im starting to learn python and after a loop function i got a list which
looks like this
>>>print test
['a','b','c','d']
['a','c','d','e']
['b','d','e','f']
I want to compare it and found things like intersection BUT as the two lists
are under... |
How do I end my while loop in python
Question: I am trying to create a guessing game for myself. I want to have the computer
have a random number which I have to guess. Based on what I guess, it would
then respond with "higher or lower" and this should keep happening before i
get the right number however what has happe... |
Python multiprocessing is taking much longer than single processing
Question: I am performing some large computations on 3 different numpy 2D arrays
sequentially. The arrays are huge, 25000x25000 each. Each computation takes
significant time so I decided to run 3 of them in parallel on 3 CPU cores on
the server. I am f... |
Bundling Data files with PyInstaller 2.1 and MEIPASS error --onefile
Question: This [question](http://stackoverflow.com/questions/7674790/bundling-data-
files-with-pyinstaller-onefile/13790741#13790741) has been asked before and I
can't seem to get my PyInstaller to work correctly. I have invoked the
following code in ... |
List Comprehension Mystery - Python
Question: I have created two CSV lists. One is an original CSV file, the other is a
DeDuped version of that file. I have read each into a list and for all intents
and purposes they are the same format. Each list item is a string.
I am trying to use a list comprehension to find out w... |
Error opening Python Serial Port
Question: I am attempting to run a script that a classmate has written and demonstrated
to me. So I know the code is correct, it just has to do with the difference in
how our machines are configured. Here is the code:
#!/usr/bin/python
#import statements
impo... |
decorate xml subtree with lxml
Question: I want to transform this xml tree
<doc>
<a>
<op>xxx</op>
</a>
</doc>
to
<doc>
<a>
<cls>
<op>xxx</op>
</cls>
</a>
</doc>
I use this python code
from lxml imp... |
Can you set conditional dependencies for Python 2 and 3 in setuptools?
Question: When releasing a Python egg with support for both Python 2 and 3, can you
specify dependencies that change depending on which version you're using? For
example, if you use `dnspython` for Python 2, there is a Python 3 version that
is calle... |
I can't execute command inside vim but it can be executed in shell?
Question: I use vim, mac os x, virtualenv and zsh to develop python.
But i found a quite strange thing that, After i using virtualenv to create a
environment and install a python package with `pip install fabric` and execute
`fab` in command line. It ... |
Cleaning a tab delimited file with unescaped newlines
Question: I have a tab-delimited file where one of the columns has occasional newlines
that haven't been escaped (enclosed in quotes):
JOB REF Comment V2 Other
1 3 45 This was a small job NULL sdnsdf
2 4 456 This was a larg... |
Cannot Import Daemon class
Question: I am trying to run a daemon but I am not able to import the module daemon.
My imports:
import os
import sys
import time
from daemon import Daemon
**Traceback (most recent call last): File "parser.py", line 11, in from daemon
import Daemon ImportErro... |
Send pandas dataframe data as html e-mail
Question: I want to send a pandas dataframe data as an HTML e-mail. Based on
[this](http://stackoverflow.com/questions/18096748/pandas-dataframes-to-html-
highlighting-table-rows) post I could create an html with the dataframe. Code
import pandas as pd
import... |
python-fu Copy an Image
Question: I've a color list file I read it into a python list and I'd like to create one
(or several) image(s) composed by squares with background color read from file
and as foreground html string of the color (written with white). I.e. I read
#ff0000 from input file then I create a 100x100 squ... |
Continually match values to a list of keys and values in Python
Question: I have a list of keys:
Keys=['Description of Supplier:', 'Locally Produced:', 'Imported:', 'Female Managed:', 'Female Owned:', 'Closest Landmark:', '% National Staff:', '% International Staff:', 'Operating since:', 'Previous Name:'... |
Pythonic way to sparsely randomly populate array?
Question: Problem: Populate a 10 x 10 array of zeros randomly with 10 1's, 20 2's, 30
3's.
**I don't actually have to use an array, rather I just need coordinates for
the positions where the values would be. It's just easier to think of in terms
of an array.**
I have ... |
How Do I Queue My Python Locks?
Question: Is there a way to make python locks queued? I have been assuming thus far in
my code that threading.lock operates on a queue. It looks like it just gives
the lock to a random locker. This is bad for me, because the program (game)
I'm working is highly dependent on getting messa... |
How to subtract the 'for' loop counter in Python?
Question: The structure that I know for the `for` loop in Python is as follows:
for i in range(10)
and then range is actually `[0,1,2,3,4,5,6,7,9]`. Now there is a problem here
and that is I want to reduce the counter of my loop by putting a line `i... |
Python/Pygame, Where do I put my pygame.time.wait loop?
Question: So, I am in the middle of making two, very similar games (Exact details are
irrelevant right now.)
Anyway, I need to know where to insert my "pygame.time.wait" code.
The exact code I need looks like this:
pygame.time.wait(100)
score ... |
Python itertools combinations in distance
Question: I'm using `itertools.combinations` to match all the possible combinations of a
list.
My list looks something like
[[1,2],[2,3],[3,4],[4,5],[5,6]]
I understand how to get all the combinations, but if i want to use the
distance formula on each comb... |
Accessing Single Entries in Sparse Matrix in Python
Question: I want to use sparse matrices for BOW feature representation. I have
experimented with coo_matrix from scipy, but it doesn't seem to support what I
want to do:
I would like to initialize a matrix of all zeros and then change a given entry
to one when approp... |
Django CompositeField subclass not overwriting __unicode__ method
Question: I'm using [django-composite-field](https://bitbucket.org/bikeshedder/django-
composite-field) to create a currency field that includes both a dollar_value
and a dollar_year (i.e., "$200 in 2008 dollars").
I have the following models in a Djang... |
Taking Screen shots of specific size
Question: What imaging modules for python will allow you to take a specific size
screenshot (not whole screen)? I have tried PIL, but can't seem to make
ImageGrab.grab() select a small rectangle and i have tried PyGame but i can't
make it take a screen shot outside of it's main disp... |
Solving Symbolic Boolean variables in Python
Question: I need to solve a set of symbolic Boolean expressions like:
>>> solve(x | y = False)
(False, False)
>>> solve(x & y = True)
(True, True)
>>> solve (x & y & z = True)
(True, True, True)
>>> solve(x ^ y = False)
... |
Multiprocessing with numpy makes Python quit unexpectedly on OSX
Question: I've run into a problem, where Python quits unexpectedly, when running
multiprocessing with numpy. I've isolated the problem, so that I can now
confirm that the multiprocessing works perfect when running the code stated
below:
imp... |
Cannot import correct version of numpy on OS X Mavericks
Question: I have upgraded from Mountain Lion to Mavericks ande also updated Macports and
its outdated packages. I have installed numpy 1.7, but the problem is the one
used by python is still numpy 1.6. The following are some information about my
system.
`>> pyth... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.