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
0answers
3 views
Handle data from added field in ModelForm via Create View
What I'm trying to do is something like this:
1) I've created model
class Example(models.Model):
username = models.CharField(max_lenght=111)
pass = models.CharField(max_lenght=111)
...
0
votes
0answers
9 views
Django; requirement dependencies on sets of fields
How could I add rules to a Django Model making certain fields that aren't required by default, required if another field is set. Or even the other way around
Let's say I have this Model:
class ...
0
votes
1answer
61 views
Why is a += x slower than a = a+x?
I'm working on optimizing a python program for which I have speed issues.
I was playing about on another document with various things that appeared on my program which could influence total speed of ...
0
votes
0answers
8 views
Tkinter Program for making a calculator
I am trying to make a simple GUI calculator just for addition/subtraction in the beginning. I am able to print the result to the console but I want to print it to the Entry box like the First Name ...
-2
votes
1answer
23 views
Best way to make a counter based on time
How can we increment a global variable every 2 seconds without using threads?
def get_interval():
var a=1;
for every 2 second
a++;
return a;
How can I increment the value of a every ...
0
votes
4answers
19 views
common elements in two lists where elements are the same
I have two lists like thw following:
a=['not','not','not','not']
b=['not','not']
and I have to find the len of the list containing the intesection of the two above list, so that the result is:
...
0
votes
0answers
9 views
SVM, testing, learning, classifying with sift and k-means/ward
I am hoping someone can explain me, if I'm on the right way. I'm trying to learn something about image retrieval and SVM but it's just a little bit confusing. I will ask my questions by posting the ...
-1
votes
1answer
9 views
python wxpython global name not defined
I'm trying to develop a very simple wxpython GUI. At the moment there is just a button which opens a file dialog & underneath that a text control box. For the moment all I am trying to do is print ...
0
votes
1answer
26 views
TypeError: 'int' object is not callable,,, len()
I wrote a program to play hangman---it's not finished but it gives me an error for some reason...
import turtle
n=False
y=True
list=()
print ("welcome to the hangman! you word is?")
word=raw_input()
...
0
votes
1answer
18 views
Django; limit Subcategory to a certain Main Category
I have a fairly simple question which I might be able to achieve by dynamically getting CHOICES by doing a query, but I was wondering if there's more "native" way to do this in Django;
Asume this;
...
0
votes
1answer
16 views
Print variable from other file with raw_input
So I'm just starting out on a project here. For starters, I have two files.
The first file is myDict.py. In there I store variables that I want to be able to fetch.
myDict.py:
numbers = [1, 5, 8, ...
0
votes
1answer
14 views
How to get inserted_primary_key from db.engine.connect().execute call
I'm using:
CPython 2.7.3,
Flask==0.10.1
Flask-SQLAlchemy==0.16
psycopg2==2.5.1
and
postgresql-9.2
Trying to get PK from insert call with alchemy.
Getting engine like so:
app = Flask(__name__)
...
0
votes
2answers
11 views
Implementing Universal Search in a Django Application
We have a large Django application made up of a large number of different views (some of which contain forms). As with most large applications, we use a base layout template that contains the common ...
0
votes
1answer
12 views
converting code from Tkinter TEXT to Tkinter LABEL
I want the received data to be centered on tk window instead of printing from top.So I want to write code using Label widget instad of TEXT widget.(TEXT widget print from top and LABEL widget centers ...
0
votes
3answers
60 views
Python: Count and rearrange numbers with same value in a list
How do I convert a list, for example:
['2', '5', '2', '5', '5', '3']
to something like:
2^2 * 5^3 * 3?
My idea was, if there was more then one of the same number, to merge them to something like ...