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
8 views
Django replace objects in queryset in view before sending to template?
How to replace objects in queryset in view before sending to template in django? modules is queryset with objects
for i,module in enumerate(modules):
try:
if [...] :
...
0
votes
0answers
21 views
Create rectangles out of values and compare them
I have this code that reads all of the .txt files in a specific directory and rewrites them in a different format, parsing and re-arranging the content of each file.
The code looks like this:
from ...
0
votes
2answers
18 views
importing lists from multiple files using a for loop in python
This is probably quite a simple problem, but can't seem to figure it out or find any answered questions with regards to this issue.
xcombined=[]
for i in range (1,20):
from 'files_'+str(i) import ...
0
votes
0answers
10 views
Sublime Text 2 Python.sublime-package
I tried adding some extra features to my python package in Sublime Text 2 and it ended up showing: Error trying to parse settings . Unexpected trailing characters in ... {my path} ...
0
votes
0answers
10 views
Python win32api doesn't work in Apache 2.2
I've got a problem printing.
I'm using the win32 API:
win32api.ShellExecute (0, "print", myfile, None, ".", 0)
This works just fine if I don't run Django through apache but when I use apache it ...
0
votes
2answers
14 views
Python create Counter object from dictionary, include a sum of values against summarised keys
I have a dictionary with {ID: (INITIALS, DATE, AREA)} like so:
>> mydict = {1: ('JN', '2012-06-13', 2),
2: ('JN', '2012-06-13', 5),
3: ('JN', '2012-06-14', 8),
...
0
votes
0answers
8 views
Please help me to extract and sort data from ,mdb file using mdb tool in Python
Quite new to Python, so any help will be appreciated. I am trying to extract and sort data from 2000 .mdb files using mdb tool on Linux. So far I was able to just take the .mdb file and dump all the ...
1
vote
1answer
12 views
Python plot frequency of fft.rfft
this is my first question here on stackoverflow and I hope I will not make huge mistakes.
I am analyzing a set of time series with sampling rate of 1 Hz. I need to plot their fourier transform in ...
1
vote
1answer
24 views
Pass variables back to the invoker of a Python interactive console session
I can set up an interactive console in the middle of a Python script, as follows:
import code
a, b = 5, 7
c = [1, 2, 34]
shareVars = {'a':a, 'b':b, 'c':c}
shell = code.InteractiveConsole(shareVars)
...
1
vote
1answer
15 views
Mapping element-wise a NumPy array into an array of more dimensions
I want map a numpy.array from NxM to NxMx3, where a vector of three elements is a function of the original entry:
lambda x: [f1(x), f2(x), f3(x)]
However, things like numpy.vectorize do not allow ...
1
vote
0answers
10 views
delete QSyntaxHighLighter from QTextEdit
I'm trying to remove QSyntaxHighLighter that was set on QTextEdit, I try:
hig = self.textEdit.findChildren(QSyntaxHighlighter)
del hig
but it does'nt work
It was set with:
highlight = ...
1
vote
0answers
22 views
Does web.py work when yield is used in handlers?
I have the following two handlers for a web.py setup:
class count1:
def GET(self):
s.session.count += 1
return str(s.session.count)
class count2:
def GET(self):
...
0
votes
1answer
23 views
Find by element and send keys not working for second time
I am using some python code with the Chrome webdriver to login to a website.
I am finding the element by id then entering both username and Password.
It works well for the first element entry be it ...
1
vote
0answers
10 views
Is there an issue with my use of pygame.rect.move?
I am using pygame.rect.move() to move a button to a certain position on instantiation. Then from the list of objects to blit that exists the menu button is called and all functions that need to be ...
1
vote
0answers
12 views
quit function call before mainloop in tkinter multiprocessed script
The script below opens a video file and displays it in a tkinter label. The frame acquisition is made in another process.
My problem is that my quit_() function will succeed in closing the full ...