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.

learn more… | top users | synonyms (2) | python jobs

0
votes
0answers
14 views

how do i treat a response from urllib2.urlopen() on python?

Im trying to get a response from a file, but when i run this code nothing is printed on the console. Anyone can help? req = urllib2.Request(url, json_payload,head) response = urllib2.urlopen(req) ...
0
votes
0answers
11 views

Error installing Distribute for Python 2.7 on Windows 7

I'm trying to install distribute for Python and all I get is the following error message: Extracting in: [directory] Extracting in c:\[directory] Now working in c:\[directory] Installing Distribute ...
0
votes
0answers
6 views

How to subclass Clock in Pyglet?

I want to subclass Clock class of pyglet.clock module, but I have some troubles when I use schedule_interval: The following code doesn't print anything: #!/usr/bin/env python # -*- coding: utf-8 -*- ...
0
votes
1answer
20 views

Validate float data type python

I'm coding a simple calculator in Python for my final project and I am having trouble validating the user's entered value is a float data type. I want to make it so that if the value is a string type, ...
1
vote
1answer
38 views

How to act differently if input is a multiple of x?

My program asks for an input from the user, but I want to reject any multiples of 26 (or if 0 is entered) and ask for the user to input again. I can't figure out how to do this; I'm guessing it's ...
-2
votes
0answers
20 views

Executing bash inside python and return to code

I was trying to build a wrapper in my environment, but i'm stuck in this problem: The user log in. I mount the user fs from my python script. and I run os.execv("/bin/bash", args). When it ...
-1
votes
1answer
22 views

Make sure input1 is not the same as input 2, if so then prompt error

I'm just curious, how do I make sure that my input1 is not equal to input2? And if that is the case then prompt an error? I am already using a def statement in my code to check that the inputs entered ...
0
votes
0answers
7 views

Django Import Redefenition models

i have the following models.py: from django.db import models from django.forms import ModelForm class Zonas(models.Model): name = models.CharField(max_length=30) def __unicode__(self): ...
0
votes
2answers
17 views

Lucene or Python: Select both “Hilary Clinton” and “Clinton, Hilary” name entries

Let's say I have some free form entries for names, where some are in the format "Last Name, First Name" and others are in the format "First Name Last Name" (eg "Bob MacDonald" and "MacDonald. Bob" are ...
0
votes
1answer
11 views

special characters in strings: concatenation in Awk

I've been trying to load a csv file into mysql, and keep getting the data truncated warning for the last field in the csv. The data is prepped with python, and I make sure that the string of the last ...
0
votes
0answers
18 views

Register a Gaming Device

I have been looking at questions related to this, but cannot find a definite answer. How can I first register a device (programatically) as a Game pad/Joystick? And then pass the events (button ...
0
votes
0answers
7 views

Django HttpResponseForbidden raised without calling view function

I am writing a django server. A really weird situation occurred -- when I tried to test it out, I POST to one of the url, only process_request middleware was hit, while both process_view and view ...
1
vote
0answers
4 views

Can't load static files with bottle on elastic beanstalk

After some help, I got my bottle application running with Elastic Beanstalk. Well almost - I still can't see any static files. I have followed the instructions here by inserting a file called ...
-5
votes
0answers
15 views

How to count bipartite graphs?

Let set A contain j distinct points Let set B contain k distinct points I am trying to find a good way to count the number of connected bipartite graphs. For instance j,k=2,2 has 5 graphs, j,k=2,4 ...
1
vote
2answers
34 views

Splitting large text file into smaller text files by line numbers using Python

I have a text file say really_big_file.txt that contains: line 1 line 2 line 3 line 4 ... line 99999 line 100000 I would like to write a Python script that divides really_big_file.txt into smaller ...

1 2 3 4 5 12249
15 30 50 per page