Questions tagged as 'python'

1
answer

multithreading chronometer in python

I am doing a project for the school in which I have to program software that helps children improve their spelling: #-*- coding: utf-8 -*- import random import subprocess def corrector(pbien, tup): if tup == pbien: return 1 e...
asked by 27.03.2018 / 03:09
1
answer

Join repeated items in a list

I try to get that from the result of a function that is returning me lists of words like the following: [('algo', 1), ('de', 1), ('una', 1), ('de', 1), ('una', 1), ('y', 1), ('otra', 1), ('cabeza', 1), ('', 1)] that another function I go pi...
asked by 29.03.2018 / 11:31
1
answer

Optional routes in Flask

Is there any way to make optional routes? For example: @app.route(r'/contacts/<key>/<name>?', methods=['GET']) def contact_deatils(key, name = None): print(key, name) return 'mensaje de prueba' if you place parameters...
asked by 26.03.2018 / 23:26
1
answer

Create a ListView and DetailView with two models

I have 2 models that are related to a OneToOneField , but I do not know how to access the 2 models, my view is as follows: class ListaSolicitudes(ListView): model = Modelo1 #aqui recibe un solo modelo, como uso el segundo modelos...
asked by 07.03.2018 / 18:09
1
answer

how to generate a csv of users in Django?

I have a problem trying to generate a CSV file with all registered users to export it. def descargar_usuarios(request): perfiles = Perfil.objects.all() response = HttpResponse(content_type='application/csv') with open('usuarios.csv','wb') as f...
asked by 05.03.2018 / 11:53
1
answer

Display information of a binary search tree python

In a class, I have a method where I call my binary tree module (do not pay attention to the name of the treeAVL) and I save the information that I take from the database: def ingresarArbol(self): arbol=ArbolAVL.ArbolBinarioBusqueda...
asked by 06.03.2018 / 04:33
1
answer

NoReverseMatch at / accounts / register u'cuentas' is not a registered namespace

I'm working with Django 1.10 and I just created a user registry but when I click save it does not redirect me to the cuentas:home page: User registration <form method="post"> {% csrf_token %} {{ form.as_p }} <but...
asked by 20.02.2018 / 16:03
1
answer

Drawing in OpenCV and Python

I'm doing an application in Python, which using the OpenCV library and passing it the height and width, I create a RGB image with the past dimensions and in which I can draw and gurantee later. I'm trying something like this: import numpy a...
asked by 21.02.2018 / 17:56
3
answers

How did a json go to a dictionary?

Good afternoon dear stackoverflow friends I have this code in which I get from an api to get bitcoin results in real time I have two questions: How can I make that json save instead of a list to a dictionary with the name values and their v...
asked by 09.08.2018 / 03:08
1
answer

Systems of nonlinear equations in python

I have the following concern with a nonlinear equation system in python : from scipy.optimize import fsolve as fs def nonlinear(z): '''Solve a sistems 2x2 not linear ''' x, y = z[0], z[1] f1 = (x**2)+(y**2)-2*(4.41*x+2.68*y)+...
asked by 30.01.2018 / 05:06