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
-
1
votes1
answer100
viewsHow I can prevent the user from pressing the button several times in a row in PYQT5
[Solved]I’m pretty beginner in pyqt, mainly in python, I’m with a problem I looked at several foruns, how can I prevent the user from pressing the button multiple times in a row? I already tried…
-
1
votes1
answer78
viewsformat a python list
I can’t format the line print('{0:>20}'.format('Alunos:'),melhores) where I have to show the best students how it looks in the picture, can help me? # coding: iso-8859-1 -*- import math nAlunos=0…
-
1
votes1
answer195
viewsCheck if the content already exists in the text file
I would like to know how to check a TXT file and if you have a line like it does not add the content again, otherwise it adds. I tried to do so: Tokens is an array with several strings, for example:…
-
1
votes1
answer94
viewsStudying lists
I have two lists, the first call from cadastro and the second call from entrada. I remove an item from the list entrada and then I want to return this item in case it’s on the list cadastro, but I…
-
1
votes1
answer56
viewsProblem to add data to a dictionary
I’m trying to build a function for calculating multi-note averages, but error occurs when I try to pass this data to a dictionary. The system claims that the class of data that I try to pass is not…
-
1
votes1
answer306
viewsSqlite - Python insert data automatically
Hi, I’m writing an algorithm that collects information from dividend companies. The collection is performed and mounts a table and up to this point everything excellent. but I would like to save in…
-
1
votes0
answers34
viewsNoreversematch with Keywords Arguments even if there is a route
I am trying to send an id to the url using Xios with the following line: const request = axios.put("{% url 'forms:save' card_id=card.card_id %}", this.body_text_value).then(response =>{…
-
1
votes0
answers32
viewsPython - pysmb move directory or access subfolders to move files
I’m programming in python to access the linux environment, using the samba protocol, pysbm, I made the connections with the server and in it there is a directory in which folders enter and leave at…
pythonasked 4 years ago Vitor Xavier 57 -
1
votes3
answers415
viewsHow do I timeout and replay a command line in Python?
I have a request for information that simply does not receive information and stands still, so forward executed and I have the answer. Then, how to have the command line be canceled after a time…
-
1
votes1
answer71
viewsAdd object validating if it exists
I am creating these two methods in which the first worth the existence of a vehicle from your name. In the second, it is intended to add a new vehicle, validating first, if there is a vehicle with a…
-
1
votes2
answers231
viewsdownload with requests and open python
The following code is part of a loop that will download multiple files and save to their respective directories. I’m trying to download the file from the "url" and want to save in a directory of…
-
1
votes1
answer54
viewsI’m not able to do the listing to know how many products were sold and the quantity
I’m not getting makes the listing to know how many products were sold and the quantity, I did a double count to store, but when I call in the other function it does not print and error produtos = []…
pythonasked 3 years, 12 months ago Paulo Freitas 21 -
1
votes0
answers41
viewsAlign columns inside the listbox (Tkinter)
I’m using this turorial to start a project: tutorial sqlite I’d like to line up the columns inside the listbox, I’ve tried some unsuccessful ways. from tkinter import * class Gui(): """Classe que…
-
1
votes1
answer44
viewsHow can I check if an element of a list that corresponds to the value of a dictionary is related to the key?
Code: entrada = '' dici_presentes = {} listavalores = [] while entrada != 'FIM': casos = int(input()) for i in range(casos): nome_presente = input().split() c = nome_presente[0] v =…
-
1
votes2
answers126
viewsHow to create nested and counting dictionaries from lists/tuples?
I have lists of sublists and tuples inside. I need to create a dictionary whose key is the car name and the value is a dictionary nested with the car model count. My lists are like this (it’s just a…
-
1
votes1
answer904
viewsHow to create bar graph using Dataframe.Plot?
I’m trying to chart a table comparing the rate of uneducated men to the rate of uneducated women. I have a csv file with this data and I’m trying to put men and women on the "x" line and the number…
-
1
votes1
answer1063
viewsCustomize/customize Python chart caption
I’m trying to create a custom caption on my Python chart on a Jupyter Notebook in Anaconda. I don’t want any rectangles around the legend. Instead of the caption appearing as it is in the image,…
-
1
votes1
answer83
viewsHow to change Threshold from a classification model?
In addition to providing classes directly, some models of machine Learning generate probability vectors of belonging to each of the classes for each observation in the sample. The class predicted by…
-
1
votes2
answers82
viewsGroup closer values in Postgresql
Good morning, you guys. I have a question regarding a grouping of data in postgresql and I would like to know if you can help me. I have a database containing a table with entry times in an…
-
1
votes1
answer58
viewsProblems tried to change function next()
I need to do this class-related activity, I don’t know much about it yet and I’m a little confused. Write a Python class with a custom iterator, when the next() function is called, it should return…
-
1
votes1
answer388
viewsOpen a url right after opening a new tab in the browser (Selenium)
I’m making a code to access a template page of my institution. Objective: In the first guide, I open the digital book; In the second guide, I open the template. However, I have to do the feedback in…
-
1
votes1
answer38
viewsHow to use for comparing a specific index?
In function bonAppetit, i want to pick up only the content k (in the case k=1 and the value is 10), and see if that number is less than or equal to b. Only my program is running the whole list. def…
-
1
votes0
answers75
viewsHow to perform a Queryset returning the biggest date with Django
I’m trying to perform a Queryset using Django, I want to return the most recent dates present in the database, along with the other fields, where I used the prefetch_related(). However, the use of…
-
1
votes1
answer62
viewsHow to get the total of combinations between two datasets and the sum of their attributes?
I have two datasets (brake and gear). Both the brake date set and the Ambios data set have attributes (Force, Aero, Grip and Rely). I would like to get the total of combinations between these…
-
1
votes1
answer241
viewsRuntime error in python 3.8 - URI
I’m practicing some examples in the URI Online Judge and I’ve come up with this example: And I tried the following solution: numeros = input().split(); N1, N2, N3, N4 = float(numeros[0]),…
-
1
votes0
answers17
viewsIs it possible to make small changes to my package without having to change the version in Pypi?
I made a package in python and added it to Pypi. Now, I’d like to update just one error message. When I make more complex updates, I create a new release on Github and update the version in my file…
-
1
votes0
answers19
viewsDisplaying PDF (created in python) on the WEB with nodejs
I have a python script that generates a PDF file according to the information provided. I created an application in nodejs so that with each POST request, the script runs generating a new PDF file.…
-
1
votes1
answer161
viewsPython log-normal distribution
I’m trying to adjust the log-normal distribution to this data but I don’t know how to find the mean, standard deviation and adjust the Python distribution curve (I’m using Jupyter in Anaconda). I…
-
1
votes0
answers52
viewsHelp with Precision in Machine Learning Sorting Algorithms
I am following a class where the teacher creates a code that will evaluate 7 different algorithms classificatory of Machine Learning and I tried to do in a more automated way so that this data…
-
1
votes1
answer342
viewsOutlier Detection with python
Hello. I am currently learning Data Science, currently I am at the beginning of Machine Learning, and during my studies I realized that the data has to be organized and within "line, "very…
-
1
votes1
answer337
viewsHow to fix Time limit exceeded error
I was trying to solve this issue in URI and I managed to reach the output required by URI. However I got the error Time limit exceeded, because the running time limit is 2s, and my code resulted in…
-
1
votes0
answers18
viewsWhat is the point of defining the type of an argument in a function in python?
I imagined that previously defining the type of argument in a function in python would automatically cause the program to return a Typeerror if the user added an argument with different typing than…
-
1
votes1
answer30
viewsStatic no Django
People, Wanted advice or help on the 'Static' in 'Django', my files that are in the 'Static" folder they are not loaded presenting the following errors below: System check identified no issues (0…
-
1
votes2
answers234
viewsError "Maximum recursion Depth exceeded" when implementing Setter
I’m learning python and wrote the following code: class Produto: def __init__(self, nome, preco): self.nome = nome self.preco = preco def desconto(self, percentual): self.preco = self.preco -…
-
1
votes0
answers46
viewsDjango: Entity Relations and Data Update
Hello, everyone, I have a Django project that issues daily reports of a company’s activities. The project is a bit complex, but I’m going to give you a simple example of a relationship that’s…
-
1
votes0
answers42
viewsIs there any difference from Binary search to ordered Binary search on a list?
I’m studying algorithms for Searching and wanted to better understand the difference between Binary search for ordered Binary search. I understood that for both algorithms to work, the list needs to…
-
1
votes0
answers26
viewsDecode accents at subprocess shell output
I’m executing the command say through the Python subprocess but it returns me the output of the command without the accents. Code import subprocess response = subprocess.check_output('dir',…
pythonasked 3 years, 11 months ago Black Coral 35 -
1
votes0
answers76
viewsREQUEST POST
Greetings, I have a test python server: from flask import request, Flask app = Flask (__name__) @app.route ('/Teste', methods=['POST']) def teste(): recebido = request.form['variavel']…
-
1
votes1
answer113
viewsClick a button that is not yet on the screen
I recently decided to do an automation using Python with the Selenium module. Everything was going well until I had to simulate a click on a button that is not on the screen at the moment and the…
-
1
votes1
answer190
viewsHow to count multiple characters from a string using Python
I want to count how many basic cracks of the type ATC (for example) have in sequence seq. What I’ve done so far is: # CONTAGEM DE NUCLEOTIDEOS # CONTAGEM DE TRINCAS/CÓDONS DE UMA SEQUENCIA seq seq =…
-
1
votes0
answers67
viewsDoubt regarding Excel manipulation through pandas library in Pycharm
I have a question regarding the manipulation of Excel through the pandas library. First I import the pandas library, then I assign to a variable the path that is the spreadsheet. import pandas as pd…
-
1
votes1
answer32
viewsCreating a new column using for
Hello people I am using this database 'https://cdn.tse.jus.br/statica/sead/odsele/votaca_partido_munzona/votacao_partido_munzona_2020.zip' to work. I would like to create a new column in the…
-
1
votes1
answer90
viewsPython How to click Divs using Selenium
I’m trying to take jobs in google jobs and extract data to guadar in database or json. Websites: GOOGLE JOBS SCREEN Notice how I have on the left a list with several jobs and when I click on some it…
-
1
votes1
answer248
viewsUsing regex to convert latitude and longitude coordinates of degrees/minutes/direction to decimal in python
I am trying to convert latitude and longitude data into python which are in the following format: Latitude Longitude 27º59' N 86º55'E This data was extracted from the following web page and…
-
1
votes1
answer364
viewsAttributeerror: str Object has no attribute 'num_points'
I am trying to create a data collector of an experiment I am doing. So far I have the following code: in an archive experiments.py has the class: import csv class Experimento: def __init__(self,…
-
1
votes1
answer40
viewsValueerror: Cannot assign "<class 'calendario.models.Shopping'>": "Parceling.shopping" must be a "Shopping" instance
I am trying to create a table of installments, in which the user will inform the purchase value, input (if you have), the amount of installments and the date of purchase. With this data I have to…
-
1
votes1
answer133
viewsAbstract class 'Excelwriter' with Abstract methods instantiatedpylint(Abstract-class-instantiated)
I’m trying to save some Dataframes in an excel file but the same is giving error, I saw some tutorials and even leaving identical still gives error. writer = pd.ExcelWriter('pandas_simple.xlsx',…
-
1
votes0
answers24
viewsPython - module 'Cdt' has no attribute 'CDT'
Hello, I am working with a code that uses two classes in two files: Radoncdt and CDT. The first one needs the second one. However, when trying to use one of the functions of the CDT class, I get the…
-
1
votes0
answers23
viewsHow to use TSNE for plotting?
I am now beginning my quest for data science. I created a code in the notebook jupyter to work with CBOW and Skip-Gram and I need to plot a similarity graph. Many with whom I talked indicated me the…
-
1
votes0
answers14
viewsWhy does winsound.SND_ASYNC need time to play?
I’m writing a program in python, which at a certain point plays a sound. However, when playing the sound, I would like my program to continue running, so I used winsound.SND_ASYNC. In which my code…
pythonasked 3 years, 10 months ago Luiz Mendes 49