Questions tagged as 'python-3.x'

1
answer

Passing order from one list to another

Good, we have a list that is ordered by a fitness already calculated called 'scored'. We are trying to 'poblacionNueva' keep the order of 'punctuated' but not show the fitness values of each element. def selection_and_reproduction(poblacionNue...
asked by 09.08.2017 / 13:43
1
answer

Get all the indices of the same element

I have two lists listA = [0, 4, 1, 3, 2] and listB = [0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4] what I want is to get all those indexes where the element of listA appears in listB or that as a result would have listR...
asked by 07.12.2018 / 00:03
2
answers

Problem with calculator in Python 3.7

I have a question I'm doing an exercise of a calculator in Python 3.7. I have the logic created and the calculator works correctly but I have the following doubt: How do I ask the user if he wants to perform another operation and in the case of...
asked by 08.12.2018 / 07:20
2
answers

extract name of a pdf with python

Good afternoon, I hope you can help me. I have a pdf that has the name "nombre_apellidop_apellidom_edad.pdf" What I need is to extract the name of the pdf and divide it in order to use the data separately, an example would be this: Jose...
asked by 09.05.2017 / 23:03
2
answers

Execute the for by changing a piece of string

Good friends, Greetings. The fact is that I am starting in the prog. And testing I found something curious. First look at the code and then the doubt. Thanks in advance def body(): print(temps) if __name__ == '__main__': temps=list...
asked by 17.05.2017 / 04:41
2
answers

Django: Error matching query does not exist

This code throws me the error:    matching query does not exist Apparently the filter I have designed does not capture the id of the Orders. Code: models.py: class Pedido(models.Model): especialidad = models.ForeignKey('Especi...
asked by 05.03.2017 / 23:43
3
answers

if-else structure does not work

#!usr/bin/env python def vocales(string): if "A" or "a" or "E" or "e" or "I" or "i" or "O" or "o" or "U" or "u" in string: nvocalesami = (string.count("a")) nvocalesama = (string.count("A")) nvocalesemi = (string.count...
asked by 13.12.2016 / 22:55
1
answer

single data type string in python3

Pythonist friends, as a newbie and trying to learn about programming in python, I would like help on how to get only data string (name) in a function, and not allow me to continue if I do not type text. my code is: class Nomina: def __init...
asked by 02.06.2017 / 19:09
1
answer

AttributeError: module 'PyQt5.QtGui' has no attribute 'QApplication'

Code: from PyQt5 import QtGui import sys app = QtGui.QApplication(sys.argv) window = QtGui.GWidget() window.show() Could you tell me why this error comes out, please. AttributeError: module 'PyQt5.QtGui' has no attribute 'QApplication'...
asked by 28.05.2016 / 19:31
1
answer

Django 1.8 Paginator inside a def get

Pager within this function and I do not know how to do it and tried several ways but it does not work out here I leave the pager code, please help me class ListarTipoAlmacen(ListView): model = Tipo_almacen template_name = 'tipo_almacen/lista...
asked by 12.05.2016 / 17:59