Python is a dynamic and strongly typed programming language that is designed to emphasize usability. Two similar but incompatible versions of Python are in widespread use (2 and 3). Please consider mentioning the version and implementation that you are using when asking a question about Python.

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

-2
votes
0answers
10 views

Write a Python program that computes and prints the following, plz help, i dont know how to do this

the average score from a list of scores the highest score from a list of scores the name of the student who got the highest score. The program starts by asking the user to enter the number of cases. ...
0
votes
0answers
10 views

UnicodeDecodeError: Python HTML Parsing

I'm using html.parser from the HTMLParser class to get the data out of a collection of html files. It goes pretty well until a file comes along and the throws an error: UnicodeDecodeError: 'utf-8' ...
0
votes
0answers
9 views

Python scalars error Fix

I'm trying to make an exponential fit to find the Lyapunov Exponent of this data, however, I keep getting this error: m=math.log10(abs(x)) TypeError: only length-1 arrays can be converted to Python ...
0
votes
1answer
28 views

Trying to calculate highest marks with name in python

grade=[] name=[] highest=0 cases=int(input('Enter number of cases: ')) for case in range(1,cases+1): print('case',case) number=int(input('Enter number of students: ')) for number in ...
0
votes
0answers
3 views

SWIG — Using typemap inside of extend

I have a c++ class written and I am using SWIG to make a Python version of my class. I would like to overload the constructor so that it can take in Python lists. For example: >>> import ...
0
votes
0answers
9 views

How is memory freed when native libraries are called from Java and Python?

I'm using the Java wrappers for OpenCV. I've also used the Python wrappers before. I read the following about JNI: The JNI framework does not provide any automatic garbage collection for non-JVM ...
0
votes
1answer
30 views

Continue to read in file after if statement

Given an if statement is true, I want to continue and append the next four lines of a CSV file reader to a list. How is this possible with the CSV class? for j in range(3): f = open("Trial_"+ ...
0
votes
2answers
9 views

python + selenium: find and click an item from 'onclick' partial value

Is it possible to click an element through selenium by a partial value of an 'onclick' element? There are multiple input items on a page, and i only need to select one with a specific string. Examples ...
0
votes
0answers
3 views

Why does asyncio.open_connection (or any other coroutine) prevent data_received from processing?

I have the following code slightly modified from the asyncio documentation import asyncio asyncio.tasks._DEBUG = True class EchoServer(asyncio.Protocol): def connection_made(self, transport): ...
-4
votes
3answers
30 views

How to create a program to prompt the user to enter a list, then have the program reverse the list and print it for the user

How can I create a program to prompt the user to enter a list, then have the program reverse the list and print it for the user. This reversal need to be manual and not use the reverse() function. So ...
-3
votes
1answer
34 views

Split lines in python 2.7

I need to attach the following statement: from xgoogle.search import GoogleSearch, SearchError import urllib import re import random import json as m_json claves = open("robot/palabras_claves.txt") ...
1
vote
2answers
32 views

Use python to dynamically create bash aliases

I'm attempting to use python to dynamically create bash aliases (like, for example, aliases to log in to a set of servers). I'd love to be able to do something like this: from subprocess import call ...
0
votes
1answer
14 views

Numpy array and column extracted from a matrix, different shape

I'm trying to do an integration with numpy: A = n.trapz(B,C) but I have some issues with B and C shapes B is a filled array inizialized with numpy zeros function B=np.zeros((N,1)) C is a column ...
1
vote
1answer
43 views

finding contiguous Subset with Largest Sum

def max_sublist(x): max1 = 0 max2 = 0 result = [] for i in x: max2 = max(0, max2 + i) max1 = max(max1, max2) print result I want to add elements till the element which had the max ...
0
votes
3answers
15 views

Django: Any way to change “upload_to” property of FileField without resorting to magic?

See this blog post... It's quite old so maybe things have changed. But in my experimenting they have not. In order to change the model field FileField upload_to path dynamically, you must resort to ...

15 30 50 per page