Tagged Questions
Python is a dynamically and strongly typed programming language whose design philosophy emphasizes code readability. Two significantly different versions of Python (2 and 3) are in use. Please mention the version that you are using when asking a question about Python.
0
votes
2answers
10 views
Python: usage about virtualenv
I initialize my project with virtualenv through these steps(in Windows 7 OS):
$ cd myproject
$ virtualenv venv
$ venv\scripts\activate
and then I try to install flask
$ pip install Flask
but I ...
1
vote
1answer
7 views
BeautifulSoup: print(s.find_all(class=“title”)) SyntaxError: invalid syntax
Script:
#!/usr/bin/python3.2
from bs4 import BeautifulSoup as bs
content = '<p class="title">hello world</p>'
s = bs(content)
print(s.find_all(class="title"))
Output:
File ...
0
votes
1answer
19 views
Altering JSON array using python
This is the way reading from a .json file on ubuntu terminal:
python -c "import json;print json.loads(open('json_file.json', 'r').read())['foo']['bar']"
What I'd like to do is altering the JSON ...
0
votes
0answers
6 views
Desktop Python App with Online Storage
I am looking for a 'sanity check' before I start working on this, as I'm new to writing server-side code. I want to stick to Python if possible, since that's what I'm used to!
I have written a ...
1
vote
3answers
41 views
python logic with dictionary and list
lloyd = {
"name": "Lloyd",
"homework": [90.0, 97.0, 75.0, 92.0],
"quizzes": [ 88.0, 40.0, 94.0],
"tests": [75.0, 90.0]
}
alice = {
"name": "Alice",
"homework": [100.0, 92.0, ...
-4
votes
0answers
14 views
merge-sort in python : “IndexError: list assignment index out of range”
def MERGE_SORT(A, p, r):
if p < r:
q = int((p+r)/2)
MERGE_SORT(A, p, q)
MERGE_SORT(A, q+1, r)
MERGE(A, p, q, r)
def MERGE(A, p, q, r):
n1 = q-p+1
n2 = ...
0
votes
0answers
6 views
Pyglet - text input - how to get it's value to a variable?
Is there a relatively simple way of getting text input from the user and store it in variable?
Asking for a name via textinput and displaying it on a label for example.
I checked out the pyglet ...
2
votes
2answers
27 views
How to find out the total time spent in a particular module?
Basically I want to find out, on a given function call how much time was spent within a particular module, including subcalls to functions in other modules as well. Any suggestion on how to achieve ...
0
votes
2answers
16 views
How to parse list containing decimal and datetime.datetime?
I have a list coming from sql output which looks like this
[(Decimal('264'), datetime.datetime(2012, 11, 1, 0, 0)), (Decimal('445812776'), datetime.datetime(2012, 12, 1, 0, 0)), ...
0
votes
0answers
5 views
OpenCV TypeError: contour is not a numpy array, neither a scalar
I'm trying to use OpenCV to extract tags from Nike images. This is a tutorial code taken from:
http://opencv-code.com/tutorials/ocr-ing-nikes-new-rsvp-program/
I've modified few lines of code though ...
0
votes
4answers
25 views
What is inf and nan?
Just a question that I'm kind of confused about
So I was messing around with float('inf') and kind of wandering what it is used for.
Also I noticed that if I add -inf + inf i get nan is that the ...
4
votes
2answers
14 views
perform varimax rotation in python using numpy
I am working on principal component analysis of a matrix. I have already found the component matrix shown below
A = np.array([[-0.73465832 -0.24819766 -0.32045055]
[-0.3728976 ...
-3
votes
1answer
32 views
Python UnbounLocalError : local variable “xxx” referenced before assignment
it's a merge-sort algorithm in python
def MERGE_SORT(A, p, r):
if p < r:
q = int((p+r)/2)
MERGE_SORT(A, p, q)
MERGE_SORT(A, q+1, r)
MERGE(A, p, q, r)
def MERGE(A, p, q, ...
0
votes
1answer
11 views
Installing Django: Using XAMPP's MySQL, MySQL-python 1.2.3 & 1.2.4 errors?
I am following this awesome walk-through on how to install python.
I don't think I have a real problem as ...I think I'm able to work on my django project... however I ran into a couple errors that I ...
1
vote
0answers
10 views
How can i use gtk3 and opengl together?
I have been looking into how to mix gtk3 and opengl, in gtk2 you could use gtkglext but this is not packaged any where meaning any software developed would not end up in software repositories.