Questions tagged as 'python'

1
answer

"List index of range" with list entered by keyboard

When I run my Python script, why do I get the error:    List index out of range although the index exists in the list? Here is my code: a=[input()] b=input() c=int(input()) d=[a[0], a[2]] print(d) When executing it, this is the erro...
asked by 14.02.2018 / 06:49
1
answer

python subclass within another subclass

Hi, I am studying the operation of classes and legacy in python, and trying to create small programs as exercises to test the theory. I do not get the program to work. Is it possible to create a subclass within another subclass, which inherits t...
asked by 04.06.2017 / 19:48
2
answers

Join with Straight Scatter Plot Matplotlib

I have a scatter diagram like the one shown in the figure and I want to join the points with segments, but not all, but in groups of a 5. That is, four segments that join the first 5 points, four segments that join the following 5 points and so...
asked by 07.08.2017 / 20:12
1
answer

I'm using Psycopg2 but I get an error message could it be because I'm using Window10?

My code is as follows: import psycopg2 import pprint import sys def main(): #Variable conexion cadenaConexion="host=localhost dbname=test1 user=postgres password=admin" print("Cadena conexion a la BD\n ->%s"%(cadenaConexi...
asked by 13.04.2017 / 16:16
1
answer

Python: Error: "function" object is not iterable

I am doing a program that opens a txt, it loads several fields: IDquestion, Question, Answer, AnswerDate and At. In the txt the fields are separated with a "^". I have an error in a function called "Savevalues", to which I associate a button. Wh...
asked by 12.04.2017 / 17:51
1
answer

line break in file.txt

if (cont == 0):#si no tiene errores manda SINTAXIS OK cadena = 'linea'+" "+str(i)+" "+str(oracion)+" "+"SINTANXIS OK"+"\n" else:#sino manda todos los errores que tiene cadena = 'linea'+' '+str(i)+" "+str(or...
asked by 09.05.2017 / 04:08
3
answers

Detect matches in multiple files with Python

Hi, I am new programming and I have been experimenting doing some scripts that have helped me a lot in my work, I would like in this case to be able to advance more with a script but I can not find a way to achieve what I want to do. My scrip...
asked by 29.12.2016 / 16:56
1
answer

Tkinter does not work-Python 3.5

I'm trying to make a GUI with Python 3.5, but it gives me an error:    Traceback (most recent call last):     File "C: \ Users \ Juan \ Desktop \ Python \ GUI_test.py", line 2, in       class Application (Frame):     File "C: \ Users \ Juan \...
asked by 24.11.2016 / 11:14
3
answers

IndexError: list index out of range

I'm creating a program to sort a list of numbers. However, the program returns me:    IndexError: list index out of range This is my code: number_list=[] list_lenght=int(input("List lenght: ")) while len(number_list)<list_lenght...
asked by 18.01.2017 / 15:04
2
answers

Implement a def within an if [PYTHON]

Hello this is the "part 2" of my question, what I want to do is that the user when you enter "1" that scrip is executed, first I will pass the code where is the if eligio = raw_input(""" 1)Extraccion de html 2)otro 3)otro Elige :><:...
asked by 23.01.2017 / 20:38