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 answer207 viewsHow to use scrapy on Asp.net pagesWell folks, my question is this:: I have to download the excel file of the product that contains the description "Maíz", Product type "Los Démas. En grano." and marketing "In bulk with 15 %… 
- 
		-1 votes1 answer412 viewsSet variables with uppercase letter in PythonWell, I’m learning python and from time to time I’ll read other dev’s codes to learn something and variables appear with uppercase letters. Examples: RETRIABLE_STATUS_CODES = [500, 502, 503, 504],… 
- 
		-1 votes1 answer45 viewsSelecting Python String List CellI have to select only the last sentence containing 'M6C13'. The text with all sentences in full is in this string path variable that receives the text through the CMD: path =… 
- 
		-1 votes1 answer90 viewsCatch current time in PythonI want to calculate the execution time of a function in nanoseconds, thus: tempoIniAlg = time_ns() vetorOrdenado = quickSort(vetor) # Vetor ordenado tempoAlg = time_ns() # Tempo de resolução do… 
- 
		-1 votes1 answer42 viewsIn-line verification in Python 3I want to put the value of a variable and if that value is not available put another. EX: variavel = 1 || 0 This is possible in Javascript, but I want to know if there is any way to do it in python.… 
- 
		-1 votes2 answers1462 viewsHow to clear Python’s Idle screen?How to clear the Python Idle screen? After several entries it becomes polluted and bad to visualize. This is possible in a practical way? 
- 
		-1 votes1 answer56 viewsError Convert data format ENTrying to convert str to date in BR format but from the error below. And if I take 'format' it goes in American format: df = pd.read_csv(‘df.csv',encoding='cp1252', sep=';') df['Data']=… 
- 
		-1 votes1 answer54 viewsProblem identifying if a word from a list is present in my string in PythonI’m looking to identify if in my input there are any words that are on a list of words that I created. The code runs normal without presenting any error, however, is missing the result always. Code:… 
- 
		-1 votes1 answer387 viewsInstall matplotlibI am trying to install matplotlib on the computer but am getting the following error: ERROR: Command errored out with Exit status 1: command: 'c: users ferco appdata local Programs python… 
- 
		-1 votes1 answer1019 viewsWindows Service with PythonI’m new with python, and I’m wanting to create a windows service using the language, I saw that there are libraries for q be done until I found some example codes and tried to adapt, when use… 
- 
		-1 votes1 answer103 views(Pandas) to_scv error in parameter Sep=I am trying to play the content of a dataset on an scv, however the parameter SEP =';' stopped working. df.to_csv(path,r'\20191122_Consolidados_camara_de_retencao.csv', sep = ';') When trying to run… 
- 
		-1 votes1 answer125 viewsIs there any way to limit the number of characters in a crypt?I need to encrypt some database keys to decrypt in the future, but all generated messages need to be the same size. md5 has generated messages of the same size, but can not translate back (E is not… 
- 
		-1 votes1 answer253 viewsHow to order a datasetI’m trying to sort the numerical values of a dataset in ascending order using : df.sort_values(by=['radius_mean'], axis=0) But I would like to sort all the columns in ascending order and not sort… 
- 
		-1 votes1 answer33 viewsMatrix in Python 3I wanted my program to run the following. 1 2 1 3 2 1 5 4 3 2 1 And the same for any other number. My code is like this: def matriz2(num_linhas): for linha in range(1,num_linhas+1): for i in… 
- 
		-1 votes1 answer92 viewsHow to save an input to a txt fileHow can I save an input from a user that is registered in my program so that even after it closes the program and opens it again it is possible to print only that user’s input? It is possible to do… 
- 
		-1 votes1 answer72 viewsHow do I get variable values out of a function?I have a function, name rounds, with another function inside, and in this function that ta inside I have a declared variable, it calls pecas_comp, i need it in function rounds but am not getting… 
- 
		-1 votes1 answer187 viewsHow to discover all possible paths to visit all vertices of a graph?I need to store all possible routes to visit the vertices of a graph without going through the same vertex twice (TSP), I thought of generating the routes randomly and storing all that are not… 
- 
		-1 votes1 answer848 viewsGet value from an Excel cell with Openpyxl (Python)I have a spreadsheet in Excel that I am analyzing some data, and when I do this loop, the returned value is a string, like '=AL35/AH35' for example, instead of a float. This set of cells I’m… 
- 
		-1 votes1 answer641 viewsHow to search all elements of an array in MongodbI have a Mongodb document as an example: { "_id": "andresm", "username": "Andre Salesmo", "carros": [ {"marca": "ferrari", "tipo": "coupe", "preco": "850000.00", "data_compra": "22/01/2015",… 
- 
		-1 votes1 answer328 viewsHow to increase the number of floats in pythonI made a program that encrypts a message, but it doesn’t work when the message is great because the result gets big. I would like to know how to make python show me the result, no matter the message… 
- 
		-1 votes1 answer221 viewsHow to validate if ternary operator was used in the implementation?I want to validate through the TDD if in the implementation was applied ternary operators. How can I measure this situation? def par_impar(x): return "impar" if x % 2 else "par" Or this other?… 
- 
		-1 votes1 answer822 viewsHow to add license for my python application?I’m having a problem. This problem is "How to create a license for my software". Suppose this is my license key - 12345YW When the user enters this license key, the software should allow him to use… 
- 
		-1 votes2 answers586 viewsHow to count repeated elements in a list of tuples?listaAnimais=[('leao', 'Simba'), ('javali', 'Pumba'), ('leao', 'Scar'), ('hiena', 'Banzai'), ('leao', 'Mufasa')] #especie,nome dicEspecies={} for especies,nome in listaAnimais:… 
- 
		-1 votes1 answer58 viewsError in string formattingI’m trying to personalize the spacing used in one string formatted, center to be very visual between the lines. The program is returning me value error. Follows the code: def titulo(msg): tam =… 
- 
		-1 votes1 answer71 viewsCannot multiply the sequence by a non-int of type 'float', even when transformed into 'map'level: beginner I need to multiply that [list] * [float]: eta = [random.random () - 0,5] * eps but when I try to make a float or a map, it still doesn’t work (because of unsupported operand types).… 
- 
		-1 votes2 answers300 viewsDoubt in PA code in PythonWas Doubtful in an exercise resolution in Python. pri_termo = int(input('Digite o primeiro Termo: ')) razao = int(input('Digite a Razão da PA: ')) termo = pri_termo cont = 1 while cont <= 10:… 
- 
		-1 votes2 answers187 viewsHow to turn a set into a Python 3.x listI’m doing an exercise that asks to, given two sets, print in ascending order (line by line) the symmetric difference between them, my code: n = set(input().split()) m = set(input().split()) m_diff =… pythonasked 5 years, 9 months ago Pirategull 659
- 
		-1 votes3 answers2084 views
- 
		-1 votes1 answer280 viewsSearch object by PYTHON class attributeGood afternoon, I wonder if I can find an object using an attribute Example: class Pessoa: def __init__(self, nome, idade, cpf) self.__nome = nome self.__idade = idade self.__cpf = cpf pessoa1 =… 
- 
		-1 votes1 answer962 viewsHow to compare two Python data framesHello guys I am trying to automate a loading process with python bringing data from sql and sending to a mysql table and I am facing some problems. Problem: I need that when I have new data in my… 
- 
		-1 votes3 answers145 viewsSame codes, different outputsWhy in the code x = 1 while (x < 4): x = x + 1 print ("x vale", x) has only one output 4, and in i = 6 while (i > 0): i = i - 3 print (i) The way out is different.… 
- 
		-1 votes1 answer25 viewsError in the user’s Manytomanyfield linkI’ve created a routine where you register a cost center. This cost center is linked through a Manytomanyfield when I register the User. Below the models.py of these registration: user models: class… 
- 
		-1 votes1 answer56 viewsPython pandas importI have this import and then set the columns I want. I can in the import itself set the columns I want? import pandas as pd… 
- 
		-1 votes1 answer77 viewsError saving an image obtained by OpencvDirectory where I need to save Banco-de-Faces\nome Directory where he is saving: Banco-de-Faces My code: cv2.imwrite("Banco-de-Faces\\" + nome + str(framesObtidos) + ".png", imagemRosto) My program… 
- 
		-1 votes1 answer50 viewsConcatenate numbers into a python csv fileI have a problem with a CSV file, because I have a CSV file with phone numbers, but the number 55 is missing in front of the numbers. how can I is doing this in python. This is my code import pandas… 
- 
		-1 votes1 answer33 viewsHow do you show only half the content the camera picks up?I wonder how to show the content captured via webcam (by videoCapture) in a window that only shows half of what the camera picks up, In opencv. pythonasked 5 years, 8 months ago junior54145 1
- 
		-1 votes1 answer63 viewsAsynchronous CommunicationI intend to implement private asynchronous communication (in python) in order to test some cryptographic algorithms. The goal would be to have an Emmiter that sends the encrypted message and have a… 
- 
		-1 votes1 answer82 viewsErrors when defining the edges of an N x N matrix? Index: list index out of rangeI created a function that takes as a parameter an Nxn matrix, and initially prints the top edge of the matrix, but I keep getting the error "Indexerror: list index out of range", and this prevents… 
- 
		-1 votes2 answers172 viewsHow to verify if Valueerror occurredI’m trying to make a program in Python that runs a second-degree equation: and delta is less than zero (no root exite); if it equals zero (only has a root); if it is greater than zero (there are two… 
- 
		-1 votes1 answer51 viewsThe best way to make an information search programI work with text production and would like to make a search program that returns pre-formatted information so that I only copy and paste in the text editor. I’m a beginner in Python, so my script is… pythonasked 6 years, 7 months ago douglas1alc 23
- 
		-1 votes1 answer74 viewsMosaicing in Python or C++?I am developing a program that, in the future, I intend to transform into app for android. I’m developing in Python, my idea was to use kivy to develop the entire app. In the current step I am… 
- 
		-1 votes1 answer174 viewsI need to count the prime numbers to a certain number nWrite the n_primes function that takes as argument an integer greater than or equal to 2 as parameter and returns the number of primes that exist between 2 and n (including 2 and, if applicable, n).… 
- 
		-1 votes1 answer152 viewsConvert string to XML objectI am consuming a SOAP Web Service and I can call through Python using the module zeep. client = Client(wsdl='meu_endpoint?WSDL') print(client.service.ObterDividaAtivaPorCPF('user','senha','cpf')) It… 
- 
		-1 votes1 answer2078 viewsCalendar in pythonGreetings !! I’ve been developing a python agenda and made it create a new list each time I run the command. He even does the correct procedure at the beginning but concludes before I finish the… pythonasked 6 years, 7 months ago Matheus vieira 1
- 
		-1 votes1 answer421 viewsProblem in performing a Groupby of a Dataframe - PandasI’m trying to accomplish a groupy in a Dataframe that consists of cases of covid-19 per state in Brazil. However when I pass the function it returns me the following error in the figure below. There… 
- 
		-1 votes1 answer84 viewsI cannot use the shell in Docker-ComposeI am developing a Python application with MYSQL in Docker-Compose, but it is not a web application, would it have any way to run this application in the container by shell ? if there is, you could… 
- 
		-1 votes1 answer77 views*Python , discounted calculations are giving a wrong value, why?tipo_comb = input('Digite [G} para gasolina \nE [A] para alcool: ') quantidade = float(input('Quantidade desejada: ')) cadastro = input('Digite [C] se possuir cadastro \nDigite [D] se não possuir… 
- 
		-1 votes1 answer118 viewsGiven any number, elaborate a function that performs the sum of its digits using recursive pythonGiven any number, prepare a function that performs the sum of its digits using of recursion. So, for example, if the number 1435 is passed as parameter, the function developed should return the… pythonasked 5 years, 7 months ago Matador DoMal 1
- 
		-1 votes1 answer2701 viewsHow does an online game server work?This is another question about online games, I recently studied Opengl and learned how the process of creating video games works, I was interested in learning more to create an MMO, for this I… 
- 
		-1 votes1 answer99 viewsModules of the Python3I’m trying to make a Scrap on a college site, I usually do in Javascript with Casperjs and even then everything ok. But now we are trying to use Python for this and I’m having problems with this…