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
answer135
viewsPython - Inventory system
I’m making a mini example game to learn more about python, and I don’t know how to remove the self.canvas.create_rectangle(50, 200, 290, 80, tag='inventario', fill='yellow') (INVENTORY ACTIVATED), I…
-
0
votes0
answers51
viewsError generating python exe with pandas-gbq
I am trying to convert a font to exe. Type the command: pyinstaller --onefile arquivo.spec Shows that it was performed successfully, but when I click on exe, the message appears ImportError: Missing…
-
0
votes0
answers22
viewsHow do I know in Django’s html if the view is filled with instance?
I am starting my studies in Django, in a CRUD, I created a single form that I would like to use for both creation and change. I would like to change the text of the button depending on the function…
-
0
votes1
answer61
viewsHow to pass parameters to a Makefile
I’m developing a Django app on Docker and not have to keep typing docker-compose exec djangoapp python manage.py <alguma coisa> i wrote a Makefile to run the commands I most use. I just don’t…
-
0
votes1
answer227
viewsDataframe Pandas - Apply the groupby of a column to other rows
Hello, I have a dataframe with a 'Time' column and 6 other columns. I only need data based on duplicate values of 'Time'. So, I already used groupby and created the "Pico" column which is where the…
-
0
votes0
answers18
viewsVariable error with Onehotencoder
When preprocessing a database, deleting part of the list, and reducing empty variables, one hot Encoder should classify the same database for the beginning of the ia tests. But it returns an error…
-
0
votes0
answers19
viewspython command
I am trying to write a code in python that tells me the information of the quand states I type the name or acronym, then I chose to use the or command to execute the same command when the acronym or…
-
0
votes0
answers25
viewsPython Help Convert PDF to Excel
Galley, I am unable to make this code below work in any way... I am trying to convert a PDF file in Excel. import re import pdfplumber import pandas as pd from collections namedtuple titulos_hvi =…
pythonasked 3 years, 11 months ago Gabriel143 1 -
0
votes1
answer38
viewsProblem To Overwrite Value
I’m not able to overwrite the self.Valorbase on the Low Income class. Could someone help me? te = 0.25588 tusd = 0.25971 icms = 0 desc_te = te - (te * 0.10 / 100) desc_tusd = tusd - (tusd * 0.30 /…
-
0
votes2
answers248
viewsChecking repeated character in Python list
Hello! I’m trying to develop a program that reads a string and returns a boolean if there are repeated characters. I need enough on that score: ("") // False ("oo") // False ("po") // True…
-
0
votes0
answers37
viewsI cannot see the database data in the Django-Rest-framework api
I’m trying to set up a chess board with Django Rest Framework, so I want only the positions to be loaded, but I always get returned only "None". This is because the last database records are…
-
0
votes1
answer64
viewsSave MP3 to a specific directory using youtube_dl
Hello! As said in the title, I’m wanting save the audio I’ll download to a specific folder from my desktop using youtube_dl, but I haven’t found a clear alternative. The directory I will use in the…
pythonasked 3 years, 10 months ago Kenneth Anderson 313 -
0
votes1
answer35
viewsWhy can’t the played method_chooses and the computer_chooses can’t access the positions [0][0],[1][0] and [2][0]?
import random class Mapa: def __init__(self): self.mapa = [["_ ","_ ","_ "],["_ ","_ ","_ "],["_ ","_…
pythonasked 3 years, 10 months ago Tiago Levi Pacheco 9 -
0
votes1
answer49
viewsHow does this algorithm look for the smallest value of an array?
I’m starting studies and I’m studying the book I understand the algorithms and in cap 2 I don’t understand this algorithm. Here in case is to find the lowest value of an element. def…
-
0
votes0
answers59
viewsPagseguro - Problem when consulting Brand
Hello, I am trying to use the transparent checkout of pagseguro. I have already integrated the session generation, but when consulting the flag of the card, the function success is never called,…
-
0
votes0
answers13
viewsPython - Path definition ST.PROJECT_ROOT = os.environ['PROJECT_ROOOT']
I’m trying to spin a test project, but it always makes that mistake: ImportError while loading conftest…
pythonasked 3 years, 10 months ago Tiago TF Dias 45 -
0
votes0
answers22
viewsSpyder Variable Explorer Error
I get this error message when I try to look at the variables in Spyder. But there is no error in the console. The code runs normal. But when I try to access the variables in Variables Explorer, this…
-
0
votes2
answers120
viewsHow would I get the user to register a name and password to log in?
In this code, as I would for the user to register a name and any password to log in? #Python 3.8.5 inicial = input("Olá!") inicial2 = input("Você é um novo usuário?") answer = input("Responda 'Sim'…
-
0
votes1
answer57
viewsDynamic Form with Flask
Hello, I’m creating a website that consists of a teacher creating a quiz and sending it to students to answer, but I’m not finding a way to get the teacher to ask as many questions as he wants. At…
-
0
votes2
answers158
viewsDjango Staticfiles not found css does not load
I am developing a Jango application, everything is running perfectly, but the static file is not being rendered on in my Catalog. I made the settings in Settings but it still doesn’t work. below is…
-
0
votes1
answer100
viewsHow do I use Python to validate the product column versus its corresponding tax by the xlsx file
Hello, everyone, good evening! I’m new to the community and need help to solve a code. I have a spreadsheet in Excel with several products and their respective tax rates. Only! Therefore, I need to…
-
0
votes0
answers18
viewsRolling Sum with conditions
I have the following dataframe data = data = [['1996-01-10', 10, 0], ['1996-01-10', 5, 0], ['1996-01-11', 4, 1], ['1996-01-13', 14, 1], ['1996-01-13', 1, 0], ['1996-01-13', 13, 0], ['1996-01-16',…
-
0
votes0
answers70
viewsPython error: Typeerror: 'numpy.float64' Object is not iterable
I am having the following problem when compiling this program in google collab: Typeerror: 'numpy.float64' Object is not iterable He points out the error in the line…
-
0
votes0
answers47
viewsIn Python, how to delete " n" from . txt files?
I’m at Jupyter Notebook working with Python. I am importing the txt files with the following code: allLines = [] path = '../data/txt/' fileList = os.listdir(path) for i in fileList: file =…
-
0
votes1
answer113
viewsError when using If parole
I am trying to analyze the data from the following table. This is a Trades record just to make it clear. DATAFRAME: def lista_preco(): #ainda falta resolver os trades depois de 19h lista_dias =…
-
0
votes1
answer45
viewsReplace multiple substrings of a dictionary
I’m trying to make a replace, but I’m not getting it. My code: dicionario = { "uva":"R$ 5,00", "abacaxi": "15%", "abacate": "preço: N/A" } for key, value in dicionario.items(): if 'R$ ' in value or…
-
0
votes1
answer188
viewsAutomation Webdriver with python
I’m using the python Selenium Webdriver to log in to a site to do some tasks, I’m able to click login, but it doesn’t take the input I ask to type. This is code Selenium: import time import requests…
-
0
votes1
answer157
views'utf-8' codec can’t Decode byte 0xe1 in position in rendering html
Greetings to all. I am trying to render an html file with Python/Django and am getting error "'utf-8' codec can’t Decode byte 0xe1 in position" because of a sharp comment. The problem wouldn’t be…
-
0
votes0
answers107
viewsSelenium in Headless mode does not find page elements (Python)
My code works normally without the headless activated, but as soon as I activate it stops working, it is as if it did not find the element on the page. The problem is not in the code of the…
-
0
votes1
answer41
viewsShow internet image in my Django app
Hi, I’m learning to use Django. I wonder if you have any way to reference static files that are not saved on my server. Example: In this way HTML works: <img {% Static 'name_da_imagem_here.jpg'…
-
0
votes0
answers26
viewsHow to put image Buttons on an image using Tkinter?
Hi, I’m developing a game and I need buttons with images to appear on another image. These buttons also need to switch between different game screens. However, I just can’t get the buttons to appear…
-
0
votes0
answers18
viewsHow to modify State selection using STATE_CHOICES on Django
have a SearchModelForm in my file forms.py in Django with the following code: from localflavor.br.br_states import STATE_CHOICES class SearchModelForm(forms.Form): name =…
-
0
votes1
answer95
viewsDocker - No module named 'Azure.Storage'; 'Azure' is not a package
I’m having problems importing the Azure-Storage-blob package into an Apache-Airflow container. My image: My running container: I installed Azure-Storage-blob but when executing a script, an error…
-
0
votes0
answers24
viewshow to join 2 lists in a third list?
what I wanted is a third list to receive the content of the other two but putting together and on the same list, like: a = [1, 2, 3] b = ['ola, mundo', 'oi'] c = [[1, 2, 3, 'ola, mundo', 'oi'], [],…
-
0
votes0
answers30
viewsDjango Rest Framework + React I can’t return the Cookie
I’m starting with Django and React development. I tried to make a User Authentication page. When loading the User Registration page I call the API in Django to return the CSRF via Cookie and then I…
-
0
votes0
answers18
viewsPython code using ROS in a Docker container
I am a beginner with ROS and am trying to run some Node Listener/talker running a really simple code in python, using ROS in a Docker container. I am following the guide described in:…
-
0
votes1
answer131
viewsPython Kick Game. Does anyone have any hints how to reduce or improve this code without using functions?
from random import randint from time import sleep valor = randint(1, 20) tentativa = 0 chute = 0 print() while chute != valor: chute = int(input('\nChute um número:…
-
0
votes0
answers16
viewsScript not getting STDOUT from subprocess
Problem Well, basically I have this Python script that calls the CMD through the subprocess and writes a command in the CMD, however, I cannot print the STDOUT of the command I tried to execute…
pythonasked 3 years, 10 months ago Black Coral 35 -
0
votes1
answer236
viewspython3 No Module Named pyaudio
I’m a beginner in python programming, so I’m getting the error/warning from my cmd Traceback (most recent call last): File…
-
0
votes0
answers17
viewsHow to make a calculation between a Beautifulsoup value and user input?
I’m doing a program that converts currency values. Then he receives 3 user queries: the selection of the 1st country currency, the selection of the 2nd country currency and the value he wants to…
-
0
votes0
answers30
viewsDatabase - Relationship - Research
Hello, guys, I’m doing a Django project and I have a question about the modeling of entities. In my project, one person can take on multiple criminal records. One day she may be a saleswoman for the…
-
0
votes1
answer49
viewsHow to take a differentiated input value using Beautifulsoup
I’m doing a little program to learn how to use Beautifulsoup and I’m doing a currency dealer that converts the value of currency X to currency Y, my program initially taken from the site of Iban all…
-
0
votes1
answer29
viewsError using a bot in python
Whenever I run the following code (using python) from chatterbot import ChatBot from chatterbot.trainers import ListTrainer bot = ChatBot('bot1') bot = ChatBot( 'bot1',…
-
0
votes1
answer35
viewsI need to delete all the contents of a list before I finish my loop
I’m having a problem in my code, I know the solution (at least I think so) but I don’t know how to fix it. I am a beginner Dev still and I am with a project to make an automatic password generator.…
pythonasked 3 years, 10 months ago Matheus' Portela 1 -
0
votes1
answer85
viewsPython/Pandas: Treatment of TXT
The ERP I’m working on is generating a . txt in the following format: ID:;1;Evento;Estado;Serial;Qtde VM;LIBERADO;471;2 Data;id_m;id_c;Data inicial;Data final 01/01/2021…
-
0
votes0
answers23
viewsI need help with pygame
Hello, I’m creating a clone of the famous game Frogger, but I’m in trouble at a point I need to change the image of the enemy(car) when it comes in reverse, follow my code here import pygame import…
-
0
votes0
answers73
viewsHow to execute a query using Python function
I set up a function that connects me to the BD and returns me a query: def consult(self, query): try: conn = mariadb.connect( user="XXXXX", password="XXXXX", host="192.168.000.000", port=3306,…
-
0
votes0
answers218
viewsFill in python/ Selenium form
I’m trying to fill out a form with python/Selenium but I can’t find the element to send the text. I can’t list the whole form, it’s private... Form: <td class="ml-FldCnt lo_22565 ml-BrdBottom"…
-
0
votes0
answers16
viewsHow can I post on blogger with Python and googleapiclient
I’m trying to make a program that automatically posts on a website of mine, which I did on the blogger. How can I do this? My code is like this: from googleapiclient.discovery import build Key =…
-
0
votes0
answers29
views3D graph error "only size-1 arrays can be converted to Python scalars"
Hello, I am trying to plot a 3D graph of an integral solution and am having the error "only size-1 arrays can be converted to Python scalars". When I try to plot a function simpler than the original…