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
-
1
votes1
answer89
viewsHow does an asynchronous method behave when executing a synchronous Python method?
In Python an asynchronous method is able to run in parallel, but if within it I have a "normal" function, it will also be run asynchronously or from that moment the execution will be "locked" and…
-
1
votes1
answer163
viewsPadding error encrypting AES CBC mode with Pycrypto
I have the following code working perfectly: from Crypto.Cipher import AES from Crypto.Util.Padding import pad, unpad key = b'Sixteen byte key' data = 'some text to encrypt'.encode("UTF-8") data =…
-
1
votes1
answer35
viewsPassing dictionaries key as parameter in integrated function
I have a simple question about using working dictionaries. Is there any way I can pass the values of the ["Age"] keys of the dictionaries in the abc list as a parameter in the Mean function?…
-
1
votes1
answer29
viewscolumn insertion via python series
I have a series collected from a column of dataframe. I need to create columns with each of this series. For example: serie = [] for s in serie: df.insert(loc=0,column=serie,value='int') columns: A…
-
1
votes1
answer340
viewsAdd functions in kivy
I’m a beginner in python and in gera programming, I’m doing a project for the school science fair and need help to add this function to my graphical interface (I’m using python 3.6 and I’m on…
-
1
votes2
answers1486
viewsHow to remove square brackets and commas when printing a list in Python?
How to remove brackets and commas from output when printing a list in Python? For example, I need the result of the code I did to look like this: 3 8 0 6 7 with numbers separated by space and just…
-
1
votes2
answers141
viewsAddition of columns in csv file - Python
I’m not able to create a csv file with a new column (month). When I try to create the whole column is only with the month of December(12) but the month column should correspond to the whole number…
-
1
votes1
answer1006
viewsPython: "list index out of range"
Issues: What makes the code snippet below? He’s making a mistake. How can I identify and correct this mistake? verificar = self.tree.column(titulos_listbox[ix], width=None) When running the code,…
-
1
votes0
answers43
viewsthread superposition bug in python
Hello, I am studying the operation of threads and I made a program where there is a function that prints the current time of 'n' in 'n' seconds, and would like to create a parallel processing where…
-
1
votes2
answers58
viewsproblems with the Return function
I’m trying to make a program where the person has to write a number, but when she writes a number that doesn’t fit the requirements she has to write another. I can’t use the function return…
-
1
votes3
answers280
viewsFinish a loop when a given string is typed
I’m trying to fill a list with numbers, so I made a loop: lista=[] i = float(input()) lista.append(i) while (i != '.'): i = float(input()) lista.append(i) However I wanted that when putting the…
-
1
votes2
answers279
viewsChanging a key value in a Python dictionary
I need to get the position of one of the key values 'Codigo', for example 321, and in the same position change the key value 'Status aluguel' for 'S'. How can I do that? Imoveis_Cadastrados = {…
-
1
votes1
answer1993
viewshow to resolve Missing 2 required positional argument python
I’m new to Python and programming and I’m trying to create a calculator (interactive way I think kkkk) using the content I’m learning to create functions, but it’s giving this error on the last line…
-
1
votes1
answer1504
viewsCreate buttons for each item in a python list using Tkinter
I developed a software that sends consumer data to a database. I made another application to receive this data and generate a graph. My goal is to create specific button for each consumption day.…
-
1
votes2
answers83
viewsFunction that creates list inside list
def add_divisors(list_num): final_list = [] divisors = [] for number in list_num: for x in range(1, number+1): if number % x == 0: divisors.append(x) final_list.extend(divisors.copy())…
-
1
votes1
answer444
viewsI wonder if it is possible to join two tables in the Django Framework
Hello friends, I’m having a slight difficulty in how to generate a third Model within Django, currently I have two tables Training and Entity would like to know if it would be possible to create…
-
1
votes1
answer88
viewsError printing HTML with Beautifulsoup
I have a simple code that accesses a quiz site and takes all the ul which contain the class square and prints on screen. url = "http://quizdomilhao.com.br/category/g1" question_page =…
-
1
votes2
answers136
viewsPython flask Static status 304
The flask is returning me the following error: 127.0.0.1 - - [13/Jun/2019 22:55:07] "GET /destino/17 HTTP/1.1" 200 - 127.0.0.1 - - [13/Jun/2019 22:55:07] "GET /static/css/bootstrap/bootstrap.min.css…
-
1
votes1
answer761
viewsHow to create a dataset to work with Keras classification
I have a series of images (12500 in total) in rgb format and I want to create a dataset to work on Keras. I want to leave them in a format similar to the Mnist dataset...with Shape (12500,50,50).…
-
1
votes0
answers24
viewsConvert CSV to XLSX with Python Azure Function App
I am trying to create a Functionapp on Azure to convert a csv file to xlsx. My original script that works on windows local is this: import pandas as pd read_file = pd.read_csv…
-
1
votes2
answers88
viewsHow to save the output (stdout) of another program to a file using Python?
Example, I give the command on the terminal: import os os.system('ipconfig') This returns me the ipconfig equal to the command in CMD, but I need to take the result that showed in the terminal and…
-
1
votes1
answer46
viewsHow to convert 10:00:00 to 10
I’m making a program that calculates time and multiplies by a value. However, using the library datetime, i get time in format "10:00:00", and if I multiply by 14.00 it returns me an error, because…
-
1
votes3
answers63
viewsHow NOT to separate a number of two or more digits when adding to a Python list?
I have a problem that, when iterating over a string and adding only the numbers in a list, a number (for example 13) eventually becomes ['1', '3']. How to get around this and make the number…
-
1
votes0
answers25
viewsWhy use re.Compile? What’s the difference between using only the desired Pattern?
We can find some difference when using re.Compile inside Python? Assuming a file with 10 lines composed by dates and a file with 10,000 lines of dates. A Pattern could be pattern =…
-
1
votes1
answer450
viewsSave Captured Data and Executed Commands with Python
I need to use Python to make several commands on a system, and at the same time go saving in a dataframe everything that is being done. There will be hundreds of commands per minute, for several…
-
1
votes0
answers113
viewsKivy Duplicating Widgets
Hello, I am trying to develop a goal program in Python and Kivy, but I have a problem, when I click on the "Add Category" button the "add_category" function is called and adds a label with the text…
-
1
votes2
answers108
viewsHelp in python Lists
Good night I’m having a hard time with this: [['1', 0.0, 1.8], ['1', 3.0, 2.0], ['1', 5.0, 1.5], ['1', 6.0, 1.5], ['1', 9.0, 3.0], ['2', 0.0, 1.8], ['2', 1.0, 1.5], ['2', 2.0, 1.5], ['2', 3.0, 2.0],…
-
1
votes1
answer483
viewsError when transporting excel data to python - date format
My code consists of pulling information from an Excel file and transporting it to a database through Python. But in data type fields (formatted in Excel itself) when importing the data they are…
-
1
votes1
answer513
viewsHow to create a hash using the hashlib library using the "time.time()" method in Python3
Hello, I have the following situation: I have to create a hexdigest of a concatenation of 2 numbers transformed into a string. For this, I must use the library hashlib and the project must be in…
-
1
votes1
answer84
viewsHow to store results of statistical calculations (mean, correlation) for later use in graphs?
[![Example of the Relevance Matrix][1]][1] I want to create a graph that is technically called "Relevance Matrix". The concept of this graph is to position the KPI (performance indicator) on x-axis,…
-
1
votes3
answers95
viewsIssue in question Python String/File Manipulation
I am new to the site and I am looking for a solution to my problem. I am currently studying Python 3 and when trying to solve this issue I get an error image, I will put here my code until the…
-
1
votes0
answers33
viewsDo you have any python library for creating an online game? The idea is Tetris in pygame, in q in it you can fzr a X1 with someone on another pc
My idea is that the two X1 screens, appear to both players, that they can see each other’s moves in real time. I couldn’t find anyone who knows a library like this or who can teach you how to use…
-
1
votes1
answer1879
viewsHow to use Pyinstaller in Python 3?
I’m developing a system with the image structure below: How do I create an executable for "Transmorphus.py"? I have tried using Pyinstaller and never opens the system. I’ve searched several sites…
-
1
votes1
answer503
viewscreate dictionary based on two lists
I have a list of items and a list of submenus (imagine a menu), because then, I would like to create a dictionary separating the items by the key of your menu. I couldn’t develop a logic that worked…
python-3.xasked 5 years, 2 months ago Rodolfo Sousa 63 -
1
votes3
answers74
viewsDisplaying message of no number read and accepting different types of input
I have the following code: def maior(colecao): if len(colecao) > 1: r = maior(colecao[1:]) if r[0] < colecao[0]: r[0] = colecao[0] elif len(colecao) == 1: r = [colecao[0]] else: r = [None]…
-
1
votes2
answers327
viewsDelete Root Directory in Python
I am creating a system that erases and creates again the folders of a directory until the creation of the folders is all ok, but I tried to use the calling below to delete a Root directory of my…
-
1
votes2
answers116
viewsShow smaller, average and larger until an empty line is typed
I have the following code: qtdNumeros = int(input()) if qtdNumeros <= 0: menor = "Nenhum" media = "Nenhuma" maior = "Nenhum" else: menor = maior = soma = float(input()) for proximo in range(1,…
-
1
votes0
answers57
viewsError during forecast attempt using Xgbregressor
I was assembling some models for data prediction in Machine Learning and ended up stopping at an error during a prediction attempt using the Linearregressor and Xgbregressor algorithms. Below…
-
1
votes0
answers292
viewsHow do I refresh a page without losing the content typed in a form?
I am developing a web application using Python and Django, and at some point I need the page to be updated, but without losing the information that was typed in a form. I tried to use the script…
-
1
votes1
answer21
viewsPython Pandas - Conditional partial dataframe string
I have the following situation: I own a dataframe: data = {"Id": ["01", "02", "03", "04",'05'],"Fruta": ['Maçã','Abacaxi','Banana','Laranja','Morango']} base_dados = pd.DataFrame(data)…
-
1
votes1
answer260
viewsList Python-flask logged-in user post
I’m a beginner in flask and I’m doing an Appweb where the user can register and register and post, is a Virtual Arline system. I built the user with SESSION and can display only his data. In my…
-
1
votes0
answers338
viewsFrame Tkinter Python does not stand next to another frame
Well, I’m having a problem assembling my simple graphical interface for a program. I’m doing it with Tkinter using python 3 and a frame just doesn’t sit next to each other! I have tried to put…
-
1
votes1
answer73
viewsLogin GITLAB using request
I am trying to log in to gitlab using python requests library but is showing the error (The change you requested was Rejected (422)) Note. I cannot use any external library(Selenium, bs4,…
-
1
votes1
answer432
viewsHow to add a Matplotlib chart on Tkinter
I have a graphic of matplotlib put in format (pizza) and I wanted to take the picture and add it to Tkinter matplotlib.use("Tkagg") DataBaser.cursor.execute(""" SELECT RendaMensal FROM Registro…
-
1
votes0
answers78
viewsManaging flask error by looping and not redirecting
I set up a server that can send and receive files, with a size limit of 50mb using ['MAX_CONTENT_LENGTH'] = 50 * 1024 * 1024, I also made a Errohandler for Error 413, which is what I get when I send…
-
1
votes0
answers11
viewssend a message to
The Rabbit connection was made correctly, it is working. If I create a queue without vhost, I can send messages normally. The problem is when you are inside one. No error, just don’t send anything…
-
1
votes1
answer465
viewsPython script error for copying . txt files
I made the following script to study. The goal is to copy all files with the extension '.txt' from the 'teste1' folder to the 'teste2' folder'. import shutil import os #Para garantir que o path é o…
-
1
votes1
answer37
viewsPassing a list like loss_weights, it should have one input per model output. Keras tells me that the model has 1 output, but I thought I had more
I have a data set df for a multiclass classification problem. I have a huge class imbalance. That is to say, grade_F and grade_G. >>> percentage = 1. /…
-
1
votes2
answers310
viewsRegular expression to get number between two bars
I have a code that takes a certain URL, divides it and returns me a list. url = 'https://www.site.com.br/categoria-produto/category/page/67/? gclid=Cjkdksjkcm35522' last_page = url if…
-
1
votes2
answers388
viewsCalculate working cut-off date
I have a project in which the user gives a day and a month where he would start some task and the program should, based on some rules, return a final date. Example of rules: maximum running days =…