Most voted "python" questions
Python is a dynamic and heavily typed programming language whose design philosophy emphasizes usability. Two similar but incompatible versions of Python are in use (2 and 3). Please mention the version you are using when asking a question about Python.
Learn more…8,642 questions
Sort by count of
-
0
votes1
answer356
viewsHow to use the Len function in a python template - Flask
I have an Appweb in python-Flask that would like to show the amount of players online, only I’m a little lost in this part already tried {% Len(date) %} and {% data|length %} and no two methods…
-
0
votes1
answer546
viewsSQLITE query returning value outside of query rule
I made a program, in python language, that creates a database SQLITE which stores information about a number of closet doors. The information stored are: id (port identification), size (PQ = small,…
-
0
votes0
answers70
viewsCalling HTML snippet in Javascript
I am using Django Framework for an application that searches videos on youtube. But there is an excerpt of JS, which calls an html where "embeds" the video searched. And I don’t know how to create…
-
0
votes1
answer546
viewsHow to open a txt file and use to print what I want
I made the following code: def caixaAlta(texto): return texto.upper() def ultimosNomes(nomeInteiro): lista = nomeInteiro.split(' ') if lista[-1].lower() == 'junior' or lista[-1].lower()=='sobrinho'…
pythonasked 6 years, 1 month ago Matheus Andrade 205 -
0
votes1
answer61
viewsHow to sort items from a list using two different values?
I have a list, which contains several values, each group of values corresponds to an audio of a language, however I am not able to sort using two conditions. audio_list = [{640: 640, 'lang': u'en',…
-
0
votes1
answer100
viewsParse file . txt using Pandas from external rules in a JSON
I have a data set in . txt format that has its own formatting with the rules described by a separate JSON file. Is there any direct way to tell Pandas to use this JSON as the basis to decode . txt?…
-
0
votes1
answer459
viewsHow to create python module and make available for any application
I wish my python program could be put into the system in such a way that with a simple import it can be executed, for example: import meucodigo meucodigo.main() My code contains several files (own…
pythonasked 6 years, 1 month ago Edeson Bizerril 661 -
0
votes1
answer170
viewsDo you know any libraries for plotting python graphics besides Matplotlib?
I would like to try other types of tables. I want to make a classification using k-Means and looking for some with animation feature, without I need to make this animation in Mallorca.
-
0
votes1
answer556
viewsHow to add text to a Qplaintextedit(PYQT5)
At first I would just like to know how to add values in a Textedit, however my goal is to take the values of the two comboBoxs and use them to generate the password. Follow the code: # -*- coding:…
-
0
votes2
answers171
viewsos.path modulo python
Can someone explain to me what happens in these 2 lines? caminhos = [os.path.join(pasta, nome) for nome in os.listdir(pasta)] arquivos = [arq for arq in caminhos if os.path.isfile(arq)]…
pythonasked 5 years, 6 months ago Jose Enrico Guedes de Lima 3 -
0
votes1
answer1110
viewsColor detection and tell which color is appearing
How could it be done so that when the predominant color in the video appears a message telling which is the predominant color? Example: appears an object in the capture of red video there would…
-
0
votes0
answers47
viewsClientexception
Hello I am taking the error Clientexception and do not know why, I am long trying to tidy up and I keep taking the same error to upload my files (I use Sentry) code below: That’s the first message…
-
0
votes2
answers745
viewstake a string string string string string string string [PYTHON]
I’m trying to get the specific value of a return I made using requests Python returned all the site’s HTML in print(Return.text), but I want to get only this input: <input class="give-input…
-
0
votes1
answer295
viewsMinimize GUI in System Tray - Python 3
Good night I made a GUI with Tkinter in python 3. I wonder if it is possible to close the window, the application was for Windows System Tray? Is there a lib or command within Tkinter for that.…
-
0
votes1
answer121
viewstuple Parameter unpacking is not supported in python 3
I started studying Python now and came across this mistake tuple parameter unpacking is not supported in python 3 Below is the excerpt of the code: #cria uma lista(user_id, numero_de_amigos)…
-
0
votes1
answer257
viewsProgram lock when executing function. Tkinter + Python3
It is the following I created a simple program to break md5 numeric, but the same lock when I click on descrypter and it only works again when it finds the hash, but it is locked until finding and…
-
0
votes1
answer303
viewsProblem with larger and smaller (while)
Develop an algorithm that reads ten user-informed values and tells the highest and lowest read value. cont = 0 n = 0 maior = n menor = n while cont < 3: n = int(input('Insira os números:…
-
0
votes2
answers711
viewsFind the second highest value
I need to find the second highest value in the iris file. entranda de dados url = 'https://archive.ics.uci.edu/ml/machine-learning- databases/iris/iris.data' iris = np.genfromtxt(url, delimiter=',',…
-
0
votes2
answers37
viewsThe program must consider all possible validations. That is, it cannot be allowed to access, delete or change a non-existent position from the list
How to put a statement that the position in the list is empty and that it is not possible to change or delete the value import sys lista = [] resposta = '' continua = '' while resposta != 'S':…
-
0
votes2
answers353
viewsHow can I encrypt a user input text? giving error
from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives.asymmetric import padding from…
-
0
votes0
answers34
viewsError closing Lib()
I’m making an implementation of lib pjsua to work with Voip using python. from datetime import datetime from time import sleep from sys import exit from pysip.callbacks import AbstractCallCallback,…
-
0
votes2
answers242
viewsPicking up request attribute with Python Json gives error
I have the following code in my application in Flask: from flask import request, json cpf = request.json['cpf'] It works normally, but when there is no attribute in the json request it displays the…
-
0
votes1
answer98
viewsstr Object has no attribute 'Encrypt'
I made a program that generates a public key and another private key, serializes them and saves them in a .key. Dai tried to create another program to encrypt and decrypt a message with these two…
-
0
votes2
answers78
viewsCheck if directory 'B' is inside directory 'A'
I am developing a script that checks the last access date of each file within every tree of a chosen directory. Files over X days without access will be moved to another directory. As a precaution,…
-
0
votes1
answer41
viewsLinearregression score
#imagem seria um numero(reconhecer caractere) novo = cv2.cvtColor(imagem, cv2.COLOR_BGR2GRAY) tamanho = cv2.resize(novo, (56, 56)) converter = tamanho.astype('float32') converter /= 255 onversao =…
-
0
votes2
answers594
viewsHow to remove all text within a parenthesis?
I want to remove all the text within a parenthesis, along with the parentheses, to return only the text that is outside them, as follows: texto = 'bla bla bla (ble ble)' I want you to turn: texto =…
-
0
votes1
answer132
viewsForce the implementation of a certain type of abstract method
In the Python it is possible to define classes abstratas and métodos abstratos slightly simply, for example: class Spam(ABC): @abstractmethod def grok(self): pass This class cannot be instantiated…
-
0
votes0
answers350
viewsProblem in python pyAudio
I’m creating a virtual assistant in Python, for the school project, I don’t know much of Python, and always the error in pyAudio, where I’ve searched how to solve and found nothing, the error are…
pythonasked 6 years, 1 month ago kingarthur 47 -
0
votes0
answers60
viewsSearch with GET not working
I’m making a system that searches for items in the system’s internal database, and in Apis like Youtube. The search should return videos(youtube) and data (internal database). The Youtube API is in…
-
0
votes2
answers250
viewsHow to print and save to a TXT
Good morning, I’d like to take the prints print inside a txt file, already saving automatically. print ("Informe o CNPJ: ", cnpj) print ("Resumo do Chamado: ", resumo) print ("Nome do…
-
0
votes1
answer66
viewsPython - Creating a program that changes itself
I would like to create a program that is able to change itself, that is, I run the script, and it changes the script itself, creating a kind of bookmark. The big problem is that I can’t change the…
-
0
votes1
answer397
viewsTweeter
I am using the API provided by Tweeter next to python to fetch certain tweets. The problem is that I wish view the tweets received by the person and not the tweets sent by them however, I am not…
-
0
votes1
answer1242
viewsChange the download name Selenium python
I am downloading a pdf through the automatic navigation through the site, for this I disabled the pdf view of Chrome and activated to download the pdf automatically, could I change the name of this…
-
0
votes1
answer492
viewsPython - scroll through a list - replace word within word (.docx)
Good morning! I need some help... I have a word file, named after 'docx test.'. I would like to replace each term inside it with strings that are in a list. See example. The problem that is…
pythonasked 6 years, 1 month ago Wilson Junior 182 -
0
votes1
answer64
viewsI want to know why you’re making this mistake on the variable?
import numpy as np # conda install numpy import cv2 as cv # conda install opencv import matplotlib.pyplot as plt #from PIL import Image # para rodar no console def showfig(image, ucmap):…
pythonasked 6 years, 1 month ago Julia Oliveira 3 -
0
votes2
answers67
viewsHow to relate two lists, obtaining the value of one through the maximum of the other?
I’m stuck in an exercise asking for an X number of teams participating in a championship. In the later lines is typed the name of the team and its score. In the output, the team that made more…
-
0
votes1
answer330
viewsHow can I keep the private and publish key for later use? Since the program always generates different keys?
Well, I wish I could save the private key and publish it to use later to encrypt and if someone wants to decrypt my message, but every time the program generates a new key. How can I save the keys…
-
0
votes1
answer73
viewsSet the site favicon (Flask)
I want to know how that puts the icon of the site, I have the icon saved on static / favicon.ico, but in the template when I try to reference, n comes to nothing, it’s as if the code n existed, I’ve…
-
0
votes0
answers245
viewsHow to format Python file in VS Code?
I am trying to format a Python document in VS Code, and the following message appears: command 'php.untrustValidationExecutable' not found How can I fix this? NOTE: Another problem, I have installed…
-
0
votes1
answer85
viewsFind the last matrix position
I’m making a game in pygame and need to know the last position of the matrix for the movement of enemies. It has to be according to the size of the matrix, that is, the last column and the first…
-
0
votes2
answers58
viewsRandom search doesn’t work
I want to do a random search in the database, but it’s not working. I want to take a sentence, and show it on the screen, it will be changed every time we update the screen. My view.py: def…
-
0
votes1
answer431
viewsPython - Kivy - pyInstaller - Generate executables
Good morning, everyone. I’m on a kivy project where I’m working with, or at least trying to work on MVC mode. So I have view, model, controller folders. In view folder I have the ". Kv" kivy files.…
-
0
votes2
answers80
viewsGuniconr/Nginx/virtualenv inside Docker
I’m trying to run the tutorial routine digitalocean inside a Docker machine. Using the official website as a basis gunicorn My problem happens in trying to reverse proxy inside the container. My…
-
0
votes1
answer517
viewsPandas dataframe.Loc() does not find the record
Good morning! I am trying to manipulate a Dataframe that originates in a DRE report (accounting). I would like the index to be the account code, which I have already been able to do. However,…
-
0
votes1
answer92
viewsHow to pass variable between class functions?
I need to pass the variable price for the function whatever of Tela4. I am new to both programming and the language itself and I have serious problems with this solution despite imagining that it is…
-
0
votes1
answer180
viewsI have a question in the kivy + sql text_input
Hello, I am trying to make a registration page and I am doing some tests in this code, for example, I am trying to make when I insert a name in the user field and press enter save this data in SQL,…
-
0
votes1
answer141
viewsIs it possible to use Sqlite3 on Android using the Qpython3 app?
I’m trying to create a table: import sqlite3 def criar_tab_contato(conexao): cursor = conexao.cursor() sql = """ CREATE TABLE IF NOT EXISTS contato( nome text, telefone text, senha text ); """…
-
0
votes1
answer18
viewsOdoo V11 - Overwrite information for a given field in the database
I am making a filter to locate the id of a record, and from there update certain fields... I am able to locate the records but I am not able to overwrite the information. if validar_voo:…
pythonasked 6 years, 1 month ago Thiago Macêdo 1 -
0
votes1
answer87
viewsI believe it’s an overflow mistake
I created two arrays as follows array1=np.arange(1000000) array2= np.arange(1000000) and when I did the following operation: array1*array2 I got that answer: array([ 0, 1, 4, ..., -731379964,…
-
0
votes0
answers78
viewsHow to make quicksort "manual"
I’ve already made one Selectionsort manual in Pyhon see below: lista = [] # digite 0 para encerrar a entrada de dados while True: x = input('Entrada: ') if x == '0': break else: lista.append(x) nota…