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
2 views
Concatenate a large number of files line for line in python
thanks for lending your eyes here.
I'm processing some spectral data that is in the form of several hundred text files (1.txt,2.txt,3.txt ...) and they are all formatted with the exact same number of ...
0
votes
0answers
22 views
Lightweight solution for a small project, language agnostic
I have a small project that I would like to start coding. Said project consists of entering data about a product along with pictures. It will have to display this information on a couple of other pc's ...
0
votes
0answers
10 views
Removing the list endpoint from a resource on tastypie
I have a Resource on my api that always return the logged-in user. The resource is read-only.
I wanted the list uri to act as the detail uri, and remove the detail urls.
So, /api/v1/user/ would ...
2
votes
0answers
33 views
Is there a faster way to separate the minimum and maximum of two arrays?
In [3]: f1 = rand(100000)
In [5]: f2 = rand(100000)
# Obvious method:
In [12]: timeit fmin = np.amin((f1, f2), axis=0); fmax = np.amax((f1, f2), axis=0)
10 loops, best of 3: 59.2 ms per loop
In ...
1
vote
2answers
8 views
Get single value from PostgreSQL row object using SQLAlchemy
I am using Python with SQLAlchemy (and GeoAlchemy in my particular case), and I have a query that results in a single column of row objects. I wish to extract particular values from these row objects, ...
0
votes
1answer
17 views
Threading error when the return function is invoked
I'm very new to threading, like an hour now, but I needed it for my code. I learned enough to use threads effectively in my situation but I'm stumped on how to get the return output from my function.
...
0
votes
0answers
10 views
Extracting Visual Event 2 output into script
In the Visual Event description, it says that it extracts "which elements have events attached to them". I can confirm this by running the bookmarklet and seeing all the colour highlights.
I would ...
0
votes
2answers
12 views
Fit Tkinter Scrollbar to Text Widget
I'm new to using tkinter. I was able to get the scrollbar to work with a text widget, but for some reason it isn't stretching to fix the text box. Does anyone know of any way to change the height of ...
0
votes
0answers
9 views
Relationship between fields - classes OpenErp
I need to relate a field first declared on product.py to a custom module i'm making.
The fields are in the product.product class as follows:
_name = "product.product"
_description = "Product"
_table ...
0
votes
3answers
37 views
Python print out float or integer
How can i print out float if the result have decimal or print out integer if the result have no decimal?
c = input("Enter the total cost of purchase: ")
bank = raw_input("Enter the bank of your ...
0
votes
1answer
34 views
Convert string to JSON in Python?
I'm trying to convert a string, generated from an http request with urllib3.
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
data = json.load(data)
...
0
votes
2answers
21 views
Extracting multiple string values of variable length before and after a delimiter in a list
I have several Python lists in the following format:
rating = ['What is your rating for?: Bob', 'What is your rating for?: Alice', 'What is your rating for?: Mary Jane']
opinion = ['What is your ...
2
votes
0answers
24 views
python execute system commands (windows)
So I have this uber script which constantly checks the system path for a program (openvpn). When you install openvpn it adds itself to the system path. I run my script in the console and, while it ...
1
vote
1answer
32 views
Python write in the same line of file
Supose i have a function like this:
f=open('file.txt','w')
n=0
while(n<20):
f.write(n)
n++
f.close()
but the loop writes all numbers to the file, and i just want the current number in ...
0
votes
4answers
45 views
Python - intersect a dict and list
Given the following data structures ,what is the most efficient way to find out the intersection - keys which are common to both the data structures.
dict1={'2A':'....','3A':'....','4B':.....}
...