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
2answers
19 views

Python: Invalid Syntax on line 1 (file <string>)

I'm new to python and programming in general and I wrote this code on Sublime Text, and I can't see the error in it. print("Please enter a quote you would like to use: ") quote = str(input()) ...
1
vote
1answer
23 views

Python Remove two for loop and solve using some iterator tool

I have a dictionary input = { 1:[23,24], 2:[21], 3:[23], 4:[] } I want output like this:- output = (1,23),(1,24),(2,21),(3,23) I did this using two for loop:- >>> ...
0
votes
0answers
6 views

Autoscale with margin in matplotlib

In order to have a plot with autoscale axes with matplotlib, I use this code: axes.set_autoscale_on(True) axes.autoscale_view(True,True,True) It works well, and I have this plot: But I'd like to ...
0
votes
0answers
7 views

Writing I420 video file with OpenCV and Python on OSX Lion

I am reading Joseph Howse's "OpenCV Computer Vision with Python" and trying examples from the book along the way. One of the examples is showing how to read a video from an avi file and how to write ...
0
votes
3answers
29 views

Why is my python output delayed to the end of the program?

I've got an extremely simple application: import sys from time import sleep for i in range(3): sys.stdout.write('.') sleep(1) print('Welcome!') I expect it to print out a dot every second ...
1
vote
0answers
7 views

How sphinx autodoc define an attribute?

I wrote a python class and I made the documentation with sphinx. For example, the class looks like : class Aclass(object): """ my class """ def __init__(self): """ constructor """ ...
-2
votes
0answers
17 views

How can I convert PDF files to epub with Python?

How can I convert PDF files to epub with Python? I have to create an application ,I want to convert PDF files to Epub format. Also flipping should be possible. How can I do this programmatically?
0
votes
1answer
20 views

Error: “dictionary update sequence element #0 has length 1; 2 is required” on Django 1.4

I have a error message on django 1.4: dictionary update sequence element #0 has length 1; 2 is required It happened when I tried to access on a hstore queryset like this: tmp[0] or when using ...
6
votes
3answers
30 views

Python string.format() percentage to one decimal place

In the example below I would like to format to 1 decimal place but python seems to like rounding up the number, is there a way to make it not round the number up? >>> '{:.1%}'.format(0.9995) ...
0
votes
0answers
8 views

how to write sqlalchemy update

I'm trying to do this query in sqlalchemy SELECT id, title, group_id, ukey_author FROM post as p1 \ WHERE p1.id=(SELECT id FROM post as p2 WHERE p1.group_id=p2.group_id \ AND ...
1
vote
1answer
15 views

creating multiple instances in pygame

I have a bit of a problem with working with pygame. See, I have a class called blockClass, but I am not quite sure how to create multiple instance of blockClass, without creating dozens of objects. Is ...
0
votes
2answers
20 views

BeautifulSoup - Insert text/var into every given td class

I have an HTML file, and I would have to insert some text / variable into one of the td classes. The td class, called "foo" sometimes got an ID, sometimes just got a class. <td align="left" ...
0
votes
1answer
14 views

Cant get Custom widget to work by replacing django's default date time widget in django admin

I had asked a question here but I think its dead. I even updated it with my progress. So after that I worked a little more with firebug for firefox and discovered some errors that make no sense to me. ...
0
votes
1answer
12 views

I installed the python3.3.2 in my PC, ubuntu12.04. And the eric IDE

For that the ubuntu itself installed the python2.7.3. So after I set up the eric, the default IDE is stil python 2.7.3. But I have installed python 3.3.2. How to re-set this for eric? because I want ...
0
votes
2answers
29 views

Prototype pattern in Python

I have the following implementation of the prototype pattern in Python 2.7: def clone (instance): x = object.__new__ (type (instance)) x.__dict__ = dict (instance.__dict__) return x ...

1 2 3 4 5 13504
15 30 50 per page