Most voted "python-3.x" questions
Python 3 is the latest version of the Python programming language and was formally released on December 3, 2008.
Learn more…3,274 questions
Sort by count of
-
0
votes2
answers174
viewsFind out which number from 1 to N is missing from a list with N - 1 numbers
Write a function that, given a list of N 1 integers numbered from 1 to N, finds out which integer of that range is missing. Input: The input parameter is an L list of size N 1 containing integers…
-
0
votes2
answers45
viewsHow to create independent dataframes in Python
I have a problem in python, as I create independent dataframe? What can I think of: >>> PREMISSAS['QTD_ESTOQUE_MEDIO'] 0 628.5 1 20202.5 2 42902.0 3 50036.0 4 8561.5 ... 12646 14356.5 12647…
-
0
votes3
answers73
viewsDoubt about storing the function result in a list and the types of stored variables
Home Post I am making a simple code that gives me the variation % between two numbers, A and B. As soon as he calculates this variation %, he should attach the result of the operation in a list that…
-
0
votes1
answer33
viewsI cannot run an audio player using Flask with Python3.7
Good afternoon! I’m trying to perform a seemingly simple task, which is to run an audio player on an HTML page using an app made in Flask, but I can’t get the player to load the audio. PYTHON APP: #…
-
0
votes0
answers41
viewsPlay one song at a time on an HTML5 Audio TAG that is dynamically created with the same ID
Good morning! I have a question regarding to be working with audio in a Web application, I have an App made in Python using Flask that sweeps a certain directory that has several MP3, so I create…
-
0
votes1
answer63
viewsPost request returns error 500
I have a simple Python script that sends a post request with a certain payload but it returns error 500. I’d really like someone to help me. The code: def answered(self,answer): headers = {…
-
0
votes1
answer51
viewsneed to do a function similar to a search in an agenda
Make a function that given as input a list with contact information and a string, if the string is in the list, must return contact information or contacts. Inside the entry list, you have lists…
-
0
votes0
answers27
viewsI would like to know how to capture more than one key being pressed at the same time?
In case I’m wanting to make both paddle move at the same time. import turtle # Function def paddle_a_up(): y = paddle_a.ycor() y += 20 paddle_a.sety(y) def paddle_a_down(): y = paddle_a.ycor() y -=…
-
0
votes0
answers15
viewsIs giving problems when using Tkinter in windowa
I ran this program on my mobile and it ran well, I went riding on PC (Windows) and gave a problem, can help me? from tkinter import * from tkinter.filedialog import * from tkinter.font import * from…
-
0
votes1
answer57
viewsSave python execution as file
I am creating a net gain calculator for Uber driver, so I would like to save the "input" as a text file, Word or Excel. Is there any way to do that? bruto = float(input('\033[0mQual o seu ganho…
-
0
votes0
answers23
viewsPYTHON - Wait for completion of a copy of files before executing the next steps
Hello I am creating a backup routine that consists of copying a series of files from one folder to another. After copying the file I want to run a getsize to recover the size of the directory. The…
-
0
votes0
answers24
viewsHow do I erase that edge on Canvas?
I want to erase this edge that’s around Canvas, but I can’t find which attribute determines its existence. Could someone help me? The code: class Tela(): def __init__(self, resolucao:str): self.inst…
-
0
votes2
answers88
viewshow to correctly pass the txt file data to a python list?
I am creating a simple program that reads data from a file .txt, passing them to a list. Then the program asks for a keyword to check if it exists in the list and show which position it is in. A…
-
0
votes1
answer142
viewsPycharm displays object class instead of the object itself
Hello, I am training the use of some packages in Python 3.x, and use Pycharm Community 2020.3.3. When I try to customize graphs and tables using packages like pandas and Seaborn Pycharm does not…
-
0
votes1
answer145
viewsUsing IF ELSE JINJA2 Python and Flask
I’m starting web development using Python and Flask, I am trying to change the class of a TAG but analyzing the value I am going through to be reinderized follows below how I am doing to try to use…
-
0
votes1
answer18
viewsDjango - Standalone - How to validate value received from a Foreign key field?
I am working on a Django project whose purpose is to take advantage of models for both forms and frontend views and for a separate service. For this I found a way to transform/use Django models with…
-
0
votes1
answer98
viewsWeb Scraping with Webdriver and python Selenium
This program aims to download excel files to optimize time. But there are the filters to be filled before downloading the file, in these filters have the start date and end date, it must be the same…
-
0
votes1
answer341
viewsWhat does this error mean and how to fix it: Eoferror: EOF when Reading a line?
The code I was testing worked perfectly in the visual studio, however, by submitting on one of these sites similar to the URI, that error appeared. I know it is a line reading error, but I could not…
-
0
votes0
answers39
viewsCheck numbers in a list and tell if they can be expressed as the sum of two prime numbers
The code below checks whether a given integer can be expressed by the sum of two primes: def sum_of_primes(num): isPrime = 1 for i in range (2,int(num/2),1): if(num % i == 0): isPrime = 0 break…
python-3.xasked 3 years, 8 months ago StatsPy 318 -
0
votes0
answers134
viewsExercise in python 3n +1
3n +1 Description Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide by 2. If n is odd, multiply by 3 and add 1. Repeat this process…
-
0
votes0
answers11
viewsHow to configure the plotly tree graph to calculate the sum and not the mean?
The official description says about this graphic : " If a color argument is passed, the color of a Node is computed as the Average of the color values of its Children, Weighted by their values."…
-
0
votes1
answer36
viewsHow to rescue sqlite3 data with python?
I have an application in Tkinter (Basic registration that every apprentice does) where I saved the data in sqlite3, but I’m having difficulties in recovering this data. What I need exactly is: That…
-
0
votes0
answers205
viewsHow to make a Python script run a Click on Windows 10?
I’m trying a simple script with python, it click on a screen coordinate. I have tried with Pyautogui, pynput, pydirectinput, pywinauto... But in none of them the click is actually done, the only…
-
0
votes1
answer53
viewsHow to change formularies in different modules
I’m using Python 3.7 I have 2 forms (windows) that I made with Pyqt5, in one of them have some Labels that I need to change according to the settings window configuration. created a modules with the…
-
0
votes0
answers30
viewsAutomation error in Selenium: Failed to change window status to 'normal'
When trying to execute a code using the Selenium library, I get the following error: <html><head></head><body></body></html> Traceback (most recent call last):…
python python-3.x selenium selenium-webdriver automationasked 3 years, 8 months ago Lucas Palmeira 13 -
0
votes0
answers74
viewsAnd python how to stop a specific thread (or all) in while loop
How to stop one, or all threads in python by ID (example) I’m developing a program that should run some loops looking for information in real time. However, when any of them find something the…
-
0
votes0
answers55
viewsAutomation with Selenium Webdriver Python
I’m doing an automation. where I access one page to be able to go to another, after going to another page I try to click on an element, but even using Webdriverwait is showing that it was not found…
-
0
votes1
answer366
viewsCompound interest in Python using "while"
Recently I was trying to solve an exercise to learn Python, but I found big problems when I tried to calculate compound interest. I used the mathematical formula of the amount and simply I have no…
-
0
votes1
answer42
viewsPython Beautifulsoup remove tag within tag
I’m having a problem while making a Scrap of a page and capturing text. Basically the beginning of my code is as follows: url0 =…
-
0
votes1
answer27
viewsHow to put a limit to my vector?
I am doing a work, and in it I find a vector with possible values for a variable, however, the values that really meet the answer, are contained in the restriction 1.5 < R < 2 . How I would…
-
0
votes0
answers28
viewsmatplotlib.axes.Axes.hist : need to understand the relationship between input and output parameters
For example, it has the following code: import matplotlib import numpy as np import matplotlib.pyplot as plt np.random.seed(10**7) mu = 121 sigma = 21 x = mu + sigma * np.random.randn(1000) num_bins…
-
0
votes0
answers19
viewsHow to close a python thread at the end of the "target" run
I think I’m having problems in my python program, by the amount of Threads generated and I’m not sure how to deal with it. Below is an excerpt of the code where N Threads are created to run the same…
-
0
votes1
answer30
viewshow to include letters in my list in python and inform the user that it has been repeated
for letra in palavra_secreta: #print(inclui_Letras) if (chute == letra): letras_acertadas[index] = letra inclui_Letras.append(letra) # incluir o 'chute' na list 'inclui_letras print(palavra_secreta,…
-
0
votes0
answers15
viewsHow to view the value of a selector in Django’s Forms.py?
I have a field that must be validated from a selector that is a foreign key in the model. py.models class NyModel1(models.Model): field1 = models.CharField(max_length=50) description =…
-
0
votes1
answer43
viewshashlib.md5(b""). Digest() equivalent in PHP
Hello guys I’m having the following problem I need to create a php script based on a python script would be all right until I find it: hashlib.md5(b"55M5033B556EUU53").digest() the exit:…
-
0
votes2
answers456
viewsPrint data from a list that is inside a dictionary - Python
Consider the following data set: Name + (N1, N2, N3, N4). Name represents a student’s name and should be used as a key. N1, N2, N3, N4 represent that student’s test scores. Use a dictionary…
-
0
votes0
answers44
viewsHow do you solve the problem when plotting the image in Pycharm using Matplotlib?
I am having trouble displaying the image/graph using pycharm community, when I run the code I get the following error message: UserWarning: Matplotlib is currently using agg, which is a non-GUI…
-
0
votes0
answers21
viewsHow to add bookmarks to a Google contact via People API?
I am adding contacts via People API with the following code: SCOPES = ['https://www.googleapis.com/auth/contacts'] def start_service(): creds = None if os.path.exists('token.pickle'): with…
-
0
votes1
answer55
viewsHow to assign a function to a kivy button?
I am a beginner in python and I want that whenever a certain button is pressed, run a function. Here is the code: application py. import kivy kivy.require("1.8.0") from kivy.app import App class…
-
0
votes1
answer46
viewsHow to reach a dropdown element through partial text in Selenium - python
How can I select an element from a dropdown through part of its name? I want to select an option based on values taken from a database, but these values do not have the full name of the elements of…
-
0
votes2
answers55
viewsPython: Run class or element inside a class
there is some way to execute a def that is within a class or some other element that I do not know about without the need to include the () of the class, only with the name? See the example below of…
-
0
votes1
answer200
viewsCreate a contact list and separate it into two other lists
I have to create a list of contacts in Python, with name, age and phone number, and then I have to separate in 2 lists: a list only with contacts over 18 years old and another list only under 18…
-
0
votes0
answers20
viewsXPATH span within div
I’m trying to get data from the site: Thing Verse, but I don’t succeed. I tried to put the html code here, but it would be too big... Anyway I search for the Xpath and find the elements I want to…
-
0
votes0
answers12
viewsDynamodb update_item: How to add an element to an attribute of an existing item
Hello, I’m new here in the OS and also with Dynamodb :) - My question should be very simple for the gurus here in the OS, I hope I am not being negligent to the documentation with my question, but I…
-
0
votes1
answer35
viewsProgram usually runs but has moments that stops in the middle of execution and does not leave the place
This program is to draw numbers for the mega sena. I got the result I wanted, but there are moments that the program stops in the middle or at the beginning of the execution. The user places the…
-
0
votes1
answer58
viewsimporting the connection of a file. py
Good morning, use Peewee with Postgresql, working very well. The connection credentials are as follows:: db = PostgresqlDatabase ( 'ALTERDATA_WSHOP', # Required by Peewee. user = 'postgres', # Will…
python-3.xasked 3 years, 6 months ago Elias Coutinho 13 -
0
votes0
answers55
viewsEven using a traffic light, I face block repetition. Why and how to avoid?
So, I have a code that I put a semaphore, thus avoiding overlap in the print, but I notice some strange occurrences of the same while. Why does this happen? There are ways to avoid? import threading…
python-3.xasked 3 years, 6 months ago Aleczk 97 -
0
votes0
answers51
viewsSelect - Dropdown menu option not selected - Python Selenium
Hello, I’m doing a Python project using Selenium. When you select to choose an option from a dropdown menu, it is not selected. I’ve always done it this way and it’s always worked and I wonder if…
-
0
votes0
answers19
viewsHow to access information in a python xml response
Good afternoon, I’m trying to make an integration with a Soap system and I don’t know how to get the information it returns to me, only work with json so far and it’s quite different, follow the…
-
0
votes1
answer48
viewsGood evening I made a poll/poll code, but it’s not computing the vote when it’s said by name instead of number
I made a line of code to do a search on a street to find out which channel people watch, and I put it to compute the vote by channel number or channel name, but it only computes the votes made by…