Questions tagged as 'python'

1
answer

Unbundle of a single file using python?

Hello, they asked me in an exam about doing "unbundle" of a file like this: archivo1 Hola que tal? archivo1 esto es una linea del archivo1 archivo2.py Sevilla tiene un color especial archivo2.py if var in entry: archivo3.txt Unbundle en varios...
asked by 30.11.2018 / 20:16
1
answer

Avoid importing python twice

I have selenium imported in 1.py , and I want to open another file that uses selenium in 2.py , but 2.py ask to import it, is it necessary to import it again? Imports of 1.py : from selenium import webdriver from selenium.common...
asked by 02.12.2018 / 23:51
0
answers

"Print" Tkinter Canvas in a PDF file

I have a small tool that generates some graphics and I show them in a Canvas. I would like to create a PDF file generated from the canvas, I am trying this solution but it does not work for me: link Is there a library to do what I want?...
asked by 03.12.2018 / 20:18
0
answers

how to make an extension of values in a list without modifying the other python

The problem I have is that in a list that believes a merger of two lists with dictionaries, I repeat the records then what I'm doing is that I verify which are repeated to put the missing values in the first in the first record, but when doing t...
asked by 30.11.2018 / 20:59
0
answers

Sort a list of products in reverse alphabetical order in Python

They ask me to sort a list of tuples that I have in a file, use lista = sorted(lista, reverse = True) print(lista) And when I run the program I see the previous steps that you made until you get to the ordered list, what I would like to kno...
asked by 07.12.2018 / 04:49
0
answers

I can not fix an IndexError: index 717 is out of bounds for axis 0 with size 64

The issue is that I'm trying to make image recognition software in a python notebook that I shot in Google Cloud, and this is the code I wrote to check if it works. Thanks in advance. h,w = (64,64) #I am doing an image recognition software, bu...
asked by 29.11.2018 / 22:59
1
answer

I do a query in a sqlite database with Flask Python and it returns none when there are rows to read

I leave the code @app.route("/") def getInicio(): conn=sqlite3.connect('datala.db') c = conn.cursor() row=c.execute('''SELECT * FROM servicio''') resultado =c.fetchone() print(resultado) conn.close() return "...
asked by 30.11.2018 / 12:59
1
answer

Show Queries with ORM grouped by a field and SUM for each TYPE in DJANGO

Very good, I have records in my DATABASE in POSTGRES and from Django ORM I try to make a query: Each record has a COST and TYPE field, and there may be N record of only one type with different prices. What I want is to bring, the sum of the COST...
asked by 12.07.2017 / 23:14
0
answers

send a pk of an object to a createview as fk of the other object

models class Mascota(models.Model): nombre = models.CharField(max_length=25) raza = models.ForeignKey(Raza, null=False, blank=False, on_delete = models.CASCADE) color = models.ForeignKey(ColorMascota, null=False, blank=False, on_...
asked by 06.12.2018 / 04:54
0
answers

Integrate XML with Python for Views

I'm going to do a program in python, and I'd like to use XML to create the views of the program. I mean, I'd like to have the python code in the .py files and the views in the .xml files Investigating a little you would have to use model-view-co...
asked by 04.12.2018 / 14:29