text stringlengths 226 34.5k |
|---|
How to parse JSON to two columns in a CSV with Python
Question: For some reason I can't log into the same account on my home computer as my
work computer.
I was able to get Bo10's code to work, but not abernert's and I would really
like to understand why.
Here is my updates to abernert's code:
imp... |
python logging with multiple modules does not work
Question: I created some Python files keeping my functions a bit separated to ease
working / fixing. All files are in one directory. The structure may get broken
down to something like:
* a.py (a class A with basic stuff)
* b.py (a class B with basic stuff)
* mo... |
How to merge two video parts and get a playable video file using Python?
Question: Here, I actually wants to merge two strings out1 & out2 (which contains the
first and second 30sec long video data) and write that to a file. So that I
will get a 1min long playable video file. But what I am getting is the first
30sec vi... |
python: how to import nested package?
Question: I have a package named myscrapy, the directory structure is:
+ spider-common
--+ myscrapy
----+ basespiders
------+ __init__.py
------+ mod.py
--+ __init__.py
--+ mod.py
And I have an enviroment variable:
export ... |
How to import a single function to my main.py in python from another module?
Question: In my script I have a function inside a module which I wish to be able to use
in my main module to prevent redundancy. This other module ( not my main, lets
call it `two.py`) contains several classes and to import a class for use in
... |
Linkedin Api for python not working correctly
Question: Linkedin Documents are confusing like crazy. I just want to get some basic
information. I need to get a company's recent updates, comments for the
update, and how many likes the update got. I tried to follow the documentation
and this is my code:
fr... |
Python Array Rotation
Question: So I am implementing a block swap algorithm in python.
The algorithm I am following is this:
Initialize A = arr[0..d-1] and B = arr[d..n-1] 1) Do following until size of A
is equal to size of B
a) If A is shorter, divide B into Bl and Br such that Br is of same length as
A. Swap A and... |
python pandas time elapsed between dynamic range
Question: I am a new python/pandas user. I am trying to get a time delta (in secs)
between dynamic ranges (based on diff in values) of a time series data frame.
My sample dataframe is:
time price
2013-04-26 09:30:03-04:00 ... |
What is acceptable in a python try statement
Question: I have a try statement that roughly follows something like this.
for result in results['matches']:
try:
#runs some functions
except KeyboardInterrupt:
leaveopt = raw_input( 'Would you like to exit or skip the c... |
How to build an offline web app using Flask?
Question: I'm prototyping an idea for a website that will use the HTML5 offline
application cache for certain purposes. The website will be built with Python
and Flask and that's where my main problem comes from: I'm working with those
two for the first time, so I'm having a... |
Accessing the print function from globals()
Question: _Apologies in advance for conflating functions and methods, I don't have time
at the moment to sort out the terminology but I'm aware of the distinction
(generally)._
I'm trying to control what functions are run by my script via command-line
arguments. After a lot ... |
Creating a Terminal Program with Python
Question: I recently started learning python. I have created some basic webapps with
Django and wrote some simple scripts. After using VIM as a Python IDE I really
fell I love with "Terminal programs" (is there an official term for this?).
Right now I am capable of doing simple t... |
Facebook python api documentation on all commands
Question: I am using the facebook api but currently their code only teaches how to get
your friends. I played with the graph api tool on their site and now I know
what I need to extract, but is there a document out there that tells you all
the commands for:
* getting... |
Python regex example
Question: If I want to replace a pattern in the following statement structure:
cat&345;
bat &#hut;
I want to replace elements starting from `&` and ending before (not including
`;`). What is the best way to do so?
Answer: Here is a good regex
`import re
result = re.su... |
Implementing an algorithm to determine if a string has all unique characters
Question: Context: I'm a CS n00b working my way through "Cracking the Coding Interview."
The first problem asks to "implement an algorithm to determine if a string has
all unique characters." My (likely naive) implementation is as follows:
... |
Django unicode error when removing ImageField from Admin interface
Question: When using the Clear checkbox to remove an uploaded image and clicking Save in
the Django Admin interface, I get the following result:
> TypeError at /admin/foo/bar/1/
>
> coercing to Unicode: need string or buffer, ImageFieldFile found
>
> E... |
add new elements to a dictionary
Question: I would like to convert stuff from my csv.reader to a dictionary. I
implemented the instructions from this post [Add to a dictionary in
Python?](http://stackoverflow.com/questions/1024847/add-to-a-dictionary-in-
python) but I keep getting `IndexError: list index out of range`.... |
Inspecting data descriptor attributes in python
Question: I'm attempting to use a data descriptor to provide some custom get/set
functionality to attributes of a class. I'd like to be able to inspect the
class at runtime and get a list of data descriptors on that class, and maybe
even determine what the type of the des... |
gunicorn_django -b 0.0.0.0 project_name/settings/production.py
Question: $ python manage.py run_gunicorn 0.0.0.0:80
--settings=project_name.settings.production
<\- It's run, OK.
but, $ gunicorn_django -b 0.0.0.0:80 project_name/settings/production.py
* * *
Traceback (most recent call last):
File ... |
Python Slice Notation with Comma/List
Question: I have come across some python code with slice notation that I am having
trouble figuring out. It looks like slice notation but uses a comma and a
list:
list[:, [1, 2, 3]]
Is this syntax valid? If so what does it do?
**edit** looks like it is a 2D nu... |
Send keystrokes to vnc server without GUI
Question: I want to make a program that connects to a VNC server and then sends a
sequence of key presses, then disconnects. And all without ever showing a GUI.
Example use:
vnckeysender SERVER KEYPRESSES
Where SERVER would be something like "10.0.0.1" and... |
Could not import settings in Django over OpenShift
Question: I'm testing OpenShift with Django/Python 2.7 and I'm getting this:
127.5.232.1 - - [2013-06-28 17:01:37] "GET / HTTP/1.1" 500 161 0.013770
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/gevent/pywsgi.py", line 4... |
Seemingly strange behavior with python counter program
Question: A portion of a recent assignment was to design a program that counts days
between dates. I have yet to finish, and I know this could be improved
drastically. However, my question is: when I run this program with **date2**
(below), an error occurs, but thi... |
Decode JSON in Bash using python mjson.tool
Question: I need to get a `key` from JSON in standard bash, and found the following:
echo '{"first_key": "value", "second_key": "value2"}' | python -mjson.tool | grep 'first_key'
But this returns:
"first_key": "value",
How can I just ... |
python plotting overrides data
Question: I have lot of binary and ascii files in one folder. I am reading them using
glob module. Doing processing of the binary data so that I can plot them. And
finally, I am trying to plot simplified binary data in one subplot and normal
ascii file in another subplot. The problem I am... |
Updating a clock on a notepad tab
Question: I'm making an application through Python and one of the tabs I'm creating is
to show the current times: local and GMT. When I start the program, it gives
me the time at which the program was started. I was wondering if there was a
way to update the times so that I can have th... |
How can I parse a formatted file into variables using Python?
Question: I have a pre-formatted text file with some variables in it, like this:
header one
name = "this is my name"
last_name = "this is my last name"
addr = "somewhere"
addr_no = 35
header
header two
... |
Python: Unicode encoding of returned String from parsed Query (MeCab)
Question: I am trying to use a program called MeCab, which does syntax analysis on
Japanese text. The problem I am having is that it returns a byte string and if
I try to print it, it prints question marks for almost all characters.
However, if I try... |
Python mongolab REST api
Question: I am trying to access the mongolab REST api through python. Is the correct way
to do this via pythons urllib2? I have tried the following:
import urllib2
p = urllib2.urlopen("https://api.mongolab.com/api/1/databases/mydb/collections/mycollection?apiKey=XXXXXXXX... |
Python re.sub - replacing character when context does not match
Question: I am trying to clean up some corrupted csv-Files. One problem is that they
contain line feeds within data fields thus splitting one data set in two. I am
looking for a piece of python-code that eliminates line feeds should they not
be followed by... |
Argv - String into Integer
Question: I'm pretty new at python and I've been playing with argv. I wrote this simple
program here and getting an error that says :
> TypeError: %d format: a number is required, not str
from sys import argv
file_name, num1, num2 = argv
int(argv[1])
int(argv[2... |
python run in powershell with script give 'non-utf' error
Question: I am a python beginner, trying to run from power shell on vista.
when trying to call a simple script with:
> python vc.py
gives error: "File "vcpy", line 1 syntaxError: Non-UTF-8 code starting with
'\xff'
... where vc.py is: import sys print sys.ve... |
FIlling in randomized form with Python and Mechanize
Question: I'm trying to use mechanize to automatically log into a website and check some
figures. I'm pretty sure I've got past the first page with the usual username
password form but the second login page asks for specific characters from an
answer to a security qu... |
How do I wait for a certain number of buttons to be clicked in Tkinter/Python?
Question: I'm trying to write a simple 'Simon' game, but I have hit a road block here,
and honestly have no idea how to get around it.
So here, I made a class for the four buttons in the GUI:
class button:
def buttonc... |
Generating permutation in Python with specific rule
Question: Let say a=[A, B, C, D], each element has a weight w, and is set to 1 if
selected, 0 if otherwise. I'd like to generate permutation in the below order
1,1,1,1
1,1,1,0
1,1,0,1
1,1,0,0
1,0,1,1
1,0,1,0
1,0,0,1
1,0,0,0
... |
python: How to remove punctuations from file
Question: I have an input file, each line of which is in the formar of a list in python.
It looks something like this:
['people', 'desert', 'snow']
['people', 'flower', 'garden', 'goat']
I want to process this file and remove all the punctuations fro... |
freebase not working in python
Question: Im trying to run freebase using python on Ubuntu 12.10 the first time. here's
what i did
import freebase
query = {
"id" : "/en/the_beatles",
"type" : "/music/artist",
"album" : [{
"name" : None,
"release_date" : None,
... |
CvtColor Error at higher resolutions
Question: I have a Logitech Pro 9000 webcam and right now I try to learn OpenCV. I use
OpenCV 2.4.5 together with Python 2.7. I'm having problems with the CvtColor
function at higher resolutions. The following script is working in 640x480,
but not with higher resolutions (800X600 an... |
How to join a string to a URL in Python?
Question: I am trying to join a string in a URL, but the problem is that since it's
spaced the other part does not get recognized as part of the URL.
Here would be an example:
import urllib
import urllib2
website = "http://example.php?id=1 order by 1--"
... |
IPython on Emacs 24.2 doesn't work
Question: I'm a beginner in emacs and I'm trying to extend so it acts like a comfortable
python IDE. Trouble is I can't seem to integrate Ipython to emacs. I'm running
emacs 24.2 with Ipython 0.13.2 on Xubuntu 13.04.
I tried adding this to my .emacs file:
(setq
py... |
Multiple-choice answers not working
Question: I'm creating a menu that is meant to look like this
1-quit
2-multiplication
3-division
I cannot seem to fix this error it has something to do with `random.randint`
What I've done so far:
iFirst= random.randint(1,10)
iSecond =... |
Send email in python using subprocess module
Question: I wrote a script to retrieve weather report from a website and send it to my
girfriend in the morning.
Using Gmail. Of course I can send it using my Postfix server. Here is the
script.
What **I'm not sure is how to use Popen() function in the situation with so
ma... |
Get a datastore object by getattr without knowing its class
Question: I want to get a entity through a ReferencePropery in this way.
getattr(model, refrence)
where model is a `db.Model` and reference is `db.ReferenceProperty`. But I get
a KindError, which I can avoid by adding import of following s... |
Python: How to store output of ls -lrt
Question: Problem : In python, how to store the o/p of 'ls -lrt' in a string so that we
can search for files of a particular pattern
This is inorder to find all files in a directory that has been modified
between date1 and date2
Thanks in advance
Answer:
>>> import subpro... |
Python - Pandas: Get a group of mean values of a daily range in a longer range period
Question: For each day, I want to get the mean value of values between a range of 8am to
5pm. With those daily mean-values I want to make a new mean value for a range-
period of for example a month or a year or a custom chosen range. ... |
running python-daemon as non-priviliged user and keeping group-memberships
Question: i'm writing a daemon in python, using the [python-
daemon](https://pypi.python.org/pypi/python-daemon/) package. the daemon is
started at boot-time (init.d) and needs to access various devices. the daemon
is to run on an embedded sysyt... |
(Python) How to XOR two hex strings so that each byte is XORed separately?
Question: I have been posting similar questions here for a couple of days now, but it
seems like I was not asking the right thing, so excuse me if I have exhausted
you with my XOR questions :D.
To the point - I have two hex strings and I want t... |
Parse data from html page to table
Question: I would like make table of chosen physical properties of elements (for example
atomization enthalpy, vaporization enthalpy, heat of vaporization, boiling
point), which are accessible on [this
page](http://environmentalchemistry.com/yogi/periodic/W.html).
It is a huge pain t... |
Elementtree, check if element has certain parent?
Question: I am parsing an xml file: <http://pastebin.com/fw151jQN> I wish to read it in
copy a lot of it and write it to a new file, some of it modified, a lot of it
unmodified, and a lot of it ignored. As an initial pass I want to find certain
xml, and write it to a ne... |
AppEngine (Python): can I know programmatically how much memory is used by the current instance?
Question: In the AppEngine control panel I can see the active instances and how much
memory they are using.
Is it possible to get the same information programmatically?
I mean, when a request is processed, is there a func... |
Python scattered chart legend
Question: I'm plotting a scattered chart which look like this :
from pylab import *
n = 1024
X = np.random.normal(0,1,n)
Y = np.random.normal(0,1,n)
T = np.arctan2(Y,X)
axes([0.025,0.025,0.95,0.95])
scatter(X,Y, s=75, c=T, alpha=.5)
... |
how to create a file and throw exception if already exists
Question: In my program, many processes can try to create a file if the file doesnt
exist currently. Now I want to ensure that only one of the processes is able
to create the file and the rest get an exception if its already been
created(kind of process safe an... |
Python sending and receiving HTTP POST
Question: I am in the process of learning Python and I am trying to do something really
simple: send an HTTP POST from one application and receive it in the other,
not only I can't get it to work, I can't get it to work with what would seem
reasonable, using def post(self). This i... |
Sorting represented data from a dictionary
Question: I am trying to sort my data, something similar to sorting example in here:
<http://www.blog.pythonlibrary.org/2011/01/04/wxpython-wx-listctrl-tips-and-
tricks/>
But for some reason when my data is represented in the table, things are all
over the place. For example,... |
Interpret list of integers as a float in Python
Question: I am attempting to convert a C code snippet into python.
The purpose of said function is to take 4, 8-bit readings from a PLC, and
decode them into a single float.
float conv_float_s7_pc(char * plc_real)
{
char tmp[4];
tmp[0] = * (plc... |
Python Requests encoding POST data
Question: Version: Python 2.7.3
Other libraries: Python-Requests 1.2.3, jinja2 (2.6)
I have a script that submits data to a forum and the problem is that non-ascii
characters appear as garbage. For instance a name like André Téchiné comes out
as André Téchiné.
Here's how the dat... |
Hadoop: Sending Files or File paths to a map reduce job
Question: supposed I had N files to process using hadoop map-reduce, let's assume they
are large, well beyond the block size and there are only a few hundred of
them. Now I would like to process each of these files, let's assume the word
counting example.
My ques... |
Objective C JSON object null but responseData not empty
Question: I am sending an HTTP request to a web service and I should get a JSON as
response. In Objective C the responseData is not empty, but the serialization
of it as JSON is null. This is my code:
- (IBAction)getProfileInfo:(id)sender
... |
How to: Pass Arguments to Python Script via Powershell
Question: I am attempting to pass 2 arguments to a python script via Powershell.
CODE:
$env:PATHEXT += ";.py"
[Environment]::SetEnvironmentVariable("Path", "$env:Path;c:\Program Files\lcpython15\", "User")
$args1 = "Test1"
$ar... |
Contour plotting orbitals in pyquante2 using matplotlib
Question: I'm currently writing line and contour plotting functions for my
[PyQuante](https://github.com/rpmuller/pyquante2) quantum chemistry package
using matplotlib. I have some great functions that evaluate basis sets along a
(npts,3) array of points, e.g.
... |
How to make a summation under a condition in Biopython
Question: I have a FASTA file with three defined elements in the "description" line.
The first element, defined as `dato[0]`, is the one that has to carry out with
the condition and the third element, defined as `dato[2]`, is the one that I
want to sum. The FASTA ... |
Matplotlib figures not working after Tkinter file dialog
Question: I'm using the following function which I found as a reply to [this
question](http://stackoverflow.com/questions/9319317/quick-and-easy-file-
dialog-in-python) to show a dialog window for file selection.
[ Edit: Turns out the distro differences here are... |
Import class in same file in Python
Question: I'm new to python and I have a file with several classes. In a method in the
class "class1" I want to use a method from another class "class2". How do I do
the import and how do I call the method from class1? I have tried several
different things but nothing seems to work.
... |
fifo - reading in a loop
Question: I want to use [os.mkfifo](http://docs.python.org/2/library/os.html#os.mkfifo)
for simple communication between programs. I have a problem with reading from
the fifo in a loop.
Consider this toy example, where I have a reader and a writer working with the
fifo. I want to be able to ru... |
New regex module fuzzy function error value. Python
Question: im trying out the fuzzy function of the new regex module. in this case, i want
there to find a match for all strings with <= 1 errors, but i'm having trouble
with it
import regex
statement = 'eol the dark elf'
test_1 = 'the dark'
... |
Does python's multiprocessing leak memory?
Question: I've narrowed down a piece of code to the following minimal (working?)
example:
import multiprocessing
def f(x): return x**2
for n in xrange(2000):
P = multiprocessing.Pool()
sol = list(P.imap(f, range(20)))
When... |
Python: randomly assign one of two values
Question:
if losttwice <= 2:
bet = _________ # <- Here
elif losttwice <= 5:
bet = bet * 2
else:
bet = startingbet
Can anyone help me to add one more thing to this? I would like to do a random
50% chance when `losttwice <= 2` (when I l... |
Converting a serial task to parallel to map inputs and outputs
Question: I have tens of thousands of simulations to run on a system with several cores.
Currently, it is done in serial, where I know my input parameters, and store
my results in a dict.
# Serial version
import time
import random
... |
Match the folder list by using regex in python
Question: How to match the following case in python regex,
str = "https://10.0.4.3/myrepos/Projects/ID87_070_138"
I need to match "ID87_070_138" this type of folders from the list of folders.
The pattern is "ID<number>_<number>_<Number>"... |
cannot use document[0] (type uint8) as type []byte in function argument
Question: I'm trying to get a JSON string pulled from a document and into SimpleJson in
GOlang, though I've run into a problem with the types (again..)
I get the following error:
> cannot use document[0] (type uint8) as type []byte in function ar... |
Error when assigning tempfile.TemporaryFile to a variable and executing
Question: So let's say that my class looks like the below, with all relevant imports
already done:
class LargeRequest(server.Request):
memory_limit = 1024*1024*25
temp_type = tempfile.TemporaryFile
def pa... |
import error while using python and Django
Question: I am making a website using the django api. Problem is I am getting a weird
import error. I have a function in a file which calls another function in
another file which in turn calls back a third function in the first file.
Problem is during that third function. Whe... |
Avoid storing passwords in plaintext for IMAP access via Python
Question: I'm trying to write a script that helps to clear IMAP inboxes, and I'm running
into a problem with passwords; namely, that to get access to the server I need
to have access to the plaintext. I've checked, and my mailserver isn't showing
MD5 as an... |
Python date string manipulation based on timezone - DST
Question: My objective is to take string(containg UTC date and time) as the input and
convert it to local timezone based on Timezone difference. I have come up with
the following code
**Code**
import time
print "Timezone Diff", time.timezone/36... |
greater than 'date' python 3
Question: I would like to be able to do greater than and less than against dates. How
would I go about doing that? For example:
date1 = "20/06/2013"
date2 = "25/06/2013"
date3 = "01/07/2013"
date4 = "07/07/2013"
datelist = [date1, date2, date3]
... |
Python - creating a histogram
Question: I'm using data of the form: `[num1,num2,..., numk]` (an array of integers).
I would like to plot a histogram of a particular form, which I will use an
example to describe.
Suppose `data = [0,5,7,2,3]`. I want a histogram with:
* Bins of width 1.
* x-axis ticks at 0,1,2,...... |
Adding values resulting from input() Python3
Question: i know this is a completely noob question, but how can i add the result from a
input(), add it and print it? this is the code:
import time
#valores de definicao da cortina
cortinas_cm = 100
cortina_preco = 5
#nome e apelido
n... |
How to read an attribute in another class?
Question: still a beginner in Python, so be kind :) FYI : Python 2.7.5, PySide 1.1.2,
OSX 10.8 Simple question. I have this function :
def openFileDialog(self):
import os
path, _ = QtGui.QFileDialog.getOpenFileName(self, "Open File", os.getcwd())... |
Python, handle persistent http connection in web application
Question: I'm in a bit over my head as a beginner with python, but I've managed to setup
a connection to the twitter streaming api via a Django application and
[tweetstream](https://pypi.python.org/pypi/tweetstream).
Within the application I can do the follo... |
Python ctype - How to pass data between C functions
Question: I have a self-made C library that I want to access using python. The problem
is that the code consists essentially of two parts, an initialization to read
in data from a number of files and a few calculations that need to be done
only once. The other part is... |
Convert timestamps of "yyyy-MM-dd'T'HH:mm:ss.SSSZ" format in Python
Question: I have a log file with timestamps like "2012-05-12T13:04:35.347-07:00". I want
to convert each timestamp into a number so that I sort them by ascending order
based on time.
How can I do this in Python? In Java I found out that I can convert ... |
Python i18n using pygettext.py
Question: I am starting on localisation, but I get stuck.
1. The program
#example.py
import gettext
t = gettext.translation('cn', 'C:\locale', fallback=True)
_ = t.ugettext
print _('Hello!')
does work.
2. But when try to use pygettext
... |
scrape google resultstats with python
Question: I would like to get the estimated results number from google for a keyword. Im
using Python3.3 and try to accomplish this task with BeautifulSoup and
urllib.request. This is my simple code so far
def numResults():
try:
page_google = '''http://ww... |
python scrapy - output csv file empty
Question: My main Spider code:
from scrapy.spider import BaseSpider
from scrapy.selector import HtmlXPathSelector
from Belray_oil.items import BelrayOilItem
class BelraySpider(BaseSpider):
name = "Belray_oil"
allowed_domains = ["m... |
python program for fetching link from a page
Question: I am trying to download an entire play list for Android development tutorial
from Youtube. So I used [savefrom](http://en.savefrom.net/) for generating
playlist for download. But the problem is that I have so many videos in that
playlist. So, I decided to write a p... |
Pictures not attached in file
Question: I am using python win32 to drive excel 2010. I want to insert pictures into
certain cells
import win32com.client as win32
from win32com.client import constants as constants
excel = win32.gencache.EnsureDispatch('Excel.Application')
excel.Visible = ... |
Using regex in python call to API to clean up return
Question: The following Python Script:
def lookup(guildname):
try:
guildname = gw2api.get_guild_details(guildid)
return guildname
except:
return''
Returns results that look like this: (each are ... |
How to load custom configuration file with twisted?
Question: I'm creating a simple server with twisted. I want to store config values in a
yaml file. I can't find examples of configuring twisted services or
applications with app-specific config.
Since the actual Resource object I'm serving will be created for each re... |
list indices must be integers python nested dictionaries
Question: In python 3, I need a function to dynamically return a value from a nested
key.
nesteddict = {'a':'a1','b':'b1','c':{'cn':'cn1'}}
print(nesteddict['c']['cn']) #gives cn1
def nestedvalueget(keys):
print(nesteddict[keys... |
Creating simply image gallery in Python, Tkinter & PIL
Question: So, I'm on simple project for a online course to make an image gallery using
python. The thing is to create 3 buttons one Next, Previous and Quit. So far
the quit button works and the next loads a new image but in a different
window, I'm quite new to pyth... |
Copying lists in python
Question: I am relatively new to Python. I am trying to come up with a function that
takes a list, adds +1 to a value at random in that list, and then places a new
list with the modified value as a new index.
For instance, if I have
blank=[]
list_one=[1,2,3,4,5] #
The ... |
Entire JSON into One SQLite Field with Python
Question: I have what is likely an easy question. I'm trying to pull a JSON from an
online source, and store it in a SQLite table. In addition to storing the data
in a rich table, corresponding to the many fields in the JSON, I would like to
also just dump the entire JSON i... |
How do I modify the file upload handlers in a class based View with CSRF middleware?
Question: In my Django project I will have to modify the tuple of file upload handlers
"on the fly" [as
documented](https://docs.djangoproject.com/en/dev/topics/http/file-
uploads/#modifying-upload-handlers-on-the-fly), to have the abi... |
Why doesn't opencv give this rectangle a colour using python's cv2
Question: The following code draws a white rectangle. However it is not supposed to do
that. Considering opencv uses BGR colorspace, it should look like this
<http://www.colorpicker.com/?colorcode=9F635F>
import cv2
import numpy as np... |
How do I monitor the change of my gtalk status message?
Question: I want to write a program (preferably in python) which could monitor my gtalk
status messages, and whenever I post a new gtalk status message, this program
will get the content of this message and post it somewhere else.
Is there a way for me to registe... |
Python: Threads stopping without any reason
Question: I am trying to make a hash breaking application that will check all the lines
of one file with all the lines in the rockyou dictionary. While with pre-
hashing the rock you i got the time of checking one hash down to a few seconds
its still not enough. This is why i... |
Get sourcecode for urls
Question: I have following codes:
import urllib2
from itertools import product
with open('urllist.txt') as urllist:
urls=[line.strip() for line in urllist]
for url in product(urls):
usock = urllib2.urlopen(url)
data = usock.read()
... |
Django ImportError on Heroku
Question: I tried several things to get my app working on heroku, but now I'm out of
ideas. I can install my project on heroku's rep, but I get a 500 error code.
My application works very well using virtualenv on my machine after I followed
the steps described on heroku documentation for dj... |
Fast 2 dimensional array of floats for python (access/write)
Question: For my project use, I need to store certain amount (~100x100) of floats in two
dimensional array. And during the function calculation I need to read and
write to the array and since the function is really the bottleneck (consuming
98% of time) I rea... |
Python 2.7.3 Math Flaw( 40 million is less then six hundred thousand )
Question: **SOLVED**
In my program, it thinks that 40 million is less then 600,000.
Here is the code: (Stop it after it loops 20 times)
import re
import urllib2
x = 0
d = 1
c = 1
highestmemberid = 1
highestme... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.