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
How to execute jquery on page update
I have used jquery multi-select to render my django app muslitiselect in an user friendly way. When My Page First render I have putted script given below on page, this script bind any element having ...
0
votes
0answers
4 views
How to get the path of a program in python?
I'm doing a program in wich Chimera needs to be opened, I'm opening it with:
def generate_files_bat(filename):
f = open(filename, 'w')
text = """echo off SET PATH=%PATH%;"C:\\Program Files ...
0
votes
0answers
2 views
Organising python packages avoiding relative imports
I'm building a collection of tools along with a supporting framework and I'm just getting to grips with package organisation in Python.
It's laid out this way:
main_package
- __init__.py
- foo.py
- ...
0
votes
0answers
11 views
Python package seems to ignore my requirements
I created my first package. When I try to install it with pip in a newly created virtualenv I get an error indicating that libs cannot be imported, yet they are added to the install_requires field in ...
0
votes
0answers
4 views
Scrapy Post request isn't working
I'm trying to crawl this site : http://jadopado.com/
First I want to change the currency so I tried this:
yield FormRequest.from_response(response,formdata={'cms_handler_name': ...
0
votes
2answers
18 views
using an integer in a string to create a dictionary (or list) with that many numbers
so i have this text (wordnet) file made up of numbers and words, for example like this -
"09807754 18 n 03 aristocrat 0 blue_blood 0 patrician"
and i want to read in the first number as a ...
0
votes
0answers
6 views
matplotlib push and pop drawing
I'm working with a GUI made with QT4 that centers around a matplotlib plot in the window. What I want to achieve is for the user to be able to interact with the plot easily and intuitively.
My ...
0
votes
0answers
18 views
serializing a nested namedtuple into json
I have a problem similar to CalvinKrishy's problem
Samplebias's solution is not working with the data I have.
I am using Python 2.7
Here's the data:
NamedTuple
>>> a_t = ...
1
vote
0answers
13 views
How to remove duplicate columns from a dataframe using python pandas
By grouping two columns I made some changes.
I generated a file using python, it resulted in 2 duplicate columns. How to remove duplicate columns from a dataframe?
0
votes
0answers
35 views
Why is .decode() not printing anything if the string starts with 0
I observed that in the following code if I set data to 0035 then nothing is printed for rdata(on the 4th line there is no output for rdata) . The console is empty but the encode still prints the value ...
-2
votes
1answer
28 views
How to write an api for my python code
I have some python code which fetches tweets and does sentiment analysis of the fetched tweets. Now, I want to create an API, for the above mentioned, which can be accessed from a website.
I have no ...
0
votes
0answers
4 views
importing weave on parallel tasks
i try to work with scipys weave.inline which works perfectly for me in serial.
In parallel i have some problems:
what i do is i run a program that uses mpi on a cluster,
then on every processor i ...
0
votes
0answers
14 views
Passing user-defined types around in Cython
Consider the following example C++ classes which I want to expose to Python via Cython. A Producer creates a Product which is passed to a Consumer.
class Product {
public:
Product() : x(42) {
...
-2
votes
0answers
42 views
Divide a string into several lines
I can make a long string (my_xml) like this:
elements = Element.objects.all()
my_xml = '<?xml version="1.0" encoding="utf-8"?>\n'
my_xml += 'description\n'
my_xml += 'document title\n'
my_xml ...
0
votes
0answers
7 views
How to show the results of a Haystack Query on a separate page
I have a index.html where my form is implemented:
...
{% block searchform%} {% endblock %}
...
In my search/ folder I have two files.
search.html, which is the actual form for the index.html
{% ...