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
votes0
answers144
viewsSet time limit for the download response of request.get() [Django and Python]
I am having problems with the server data return time when I make a get request. The server starts the data transmission, but sometimes it takes too long to complete the upload (more than 30…
-
0
votes1
answer42
viewsAsync and Tkinter function
I’m trying to integrate the async function of the Telethon below to the command of a button on the Tkinter, but I don’t know how to proceed... The function below works for sending message at the…
-
0
votes1
answer42
viewsUse arguments in a function from another function
I have a text document with the following format: word_1 word_2 word_3 word_4 word_5 word_6 For each line of that text document: first: I want to save the words and add "_info" to each word; second:…
-
0
votes1
answer54
viewsRegplot with year on X-axis (Python)
I’m trying to plot a regression graph where the date interval is in year format, but I can’t centralize the data on the X axis. The chart range below is between 2016 and 2020.…
-
0
votes1
answer76
viewsPython - take csv values under certain conditions
I am new in python and am trying to get information from a CSV and pass to JSON. The CSV is of this format: QTD Produto Estoque_Limitado 20 pipoca 1 19 refrigerante 1 21 doces 0 "Stock_limited"…
-
0
votes4
answers169
viewsPython - Return all cities of a.txt file in a percentage range
I’m having trouble returning all cities with the percentage within a range that the user has gone through. My text file consists of these cities and their respective isolation rates: São Paulo = 30…
-
0
votes1
answer43
viewsLoop to append Googlesearch to multiple elements of a list
Hello, What’s up, little community? I am a beginner with Python and programming in general and I would like to ask a question. Briefly describing the problem: I am using Googlesearch to return the…
-
0
votes2
answers100
viewsDataframe row and column organization
Hello, I have the following situation: import pandas as pd import numpy as np l=[] l.append(('Mod1',0,70)) l.append(('Mod1',1,88)) l.append(('Mod1',2,97)) l.append(('Mod2',0,44))…
-
0
votes1
answer170
viewsHow to scan the IP of a user-selected network, and show what is being used and what is available, in order. PYTHON
Hello, I’m trying to develop a basic program, to run both in linux and in WINDOWS, in which I can let the user choose the original ip and the end and show among all of the network which Ips are…
-
0
votes2
answers44
viewsHow can I check if two values of two matrices are in the same position?
I am trying to create a mini login system using python, where a login and password are requested, and if the two match, for example: the login is at position 2 and the password is also at position…
-
0
votes2
answers102
viewsMy function only returns None
I was creating/trying to create a python chat bot, so far so good. But when I use my function that returns the robot’s answer it returns None! I don’t know how to fix... def responder(conversa1,…
-
0
votes1
answer1991
viewstypeError: 'module' Object is not callable
I’m trying to add layers to my game window, so I tried using Sprite groups, but there’s this mistake that I don’t understand why it persists: TypeError: 'module' object is not callable I searched…
-
0
votes1
answer232
viewsSqlite3 syntax error
Does anyone know why you made that mistake? before using the androidhelper was working, I realized I was returning a different format, so I turned it into a string equal to a common input: def…
-
0
votes1
answer322
viewsAttributeerror: 'list' Object has no attribute 'distance'
I am trying to solve the game of the 8 in python, but I stopped in this error. Someone can help me? import random from copy import copy, deepcopy class Tabuleiro: tabuleiro = [] meta = [[1, 2, 3],…
pythonasked 4 years, 5 months ago Luiz Gabriel 3 -
0
votes2
answers77
viewsWhat can be done to improve my counting function?
I have this program that simulates games of a mega "lottery" style. It works normal, but I would like to improve my 'count' function to present all the repeated values of each number within each…
pythonasked 4 years, 5 months ago Marcelo Ivan 45 -
0
votes1
answer147
viewsWhat does backref mean in relation tables Many to Many in Sqlalchemy?
I am creating a database template in my models.py for my Flask application. I have a User table, and each user can have multiple instruments, and one instrument can have multiple users. In the…
-
0
votes1
answer243
viewsremove brackets from the values stored in a dictionary
When trying to use an excel spreadsheet as a data source for my DOCX-TEMPLATE, the dictionary I am generating is storing the values with brackets, and these and brackets are appearing in the final…
-
0
votes1
answer368
viewsHow to update the Tkinter window?
I made a program that plays dice. I used the graphical library Tkinter to create buttons and Labels. I use the button to activate a function that generates a random number, but the label does not…
-
0
votes0
answers108
viewsHow to run Selenium and Tkinter at the same time without stopping to answer
Good morning to you all! I have a python code that I use from Tkinter and Selenium to get all the books that Amazon recently made available for free, but Tkinter stops responding as Selenium opens,…
-
0
votes1
answer128
viewsPython and the ipaddress module
Hello, I have a TXT file containing 340,000 lines of decimal IP addresses, for example: 16777262. Using the ipaddress module I can convert the decimal to the punctuated format '1.0.0.46'. As…
-
0
votes1
answer147
viewsHow to register data in a dictionary within a . txt file?
I’m running a registration system, which records a person’s user and password in a dictionary and then passes that dictionary to a .txt. See the example: user = 'Lucas' password = '1234'` dic = {}…
-
0
votes1
answer512
viewsSeparate Bar Graph - python [colab]
Staff how do I make the revenue and expense bars separate and not overlap on the chart? Thanks for being able to help. import pandas as pd import matplotlib.pyplot as plt #saldo em caixa no início…
-
0
votes3
answers182
viewsBug when trying to use Pysimplegui
I’m learning how to use Simplepythongui, but I’m encountering a bug. The problem is this: when I get to if down there, even if the number random and the one chosen by the user are equal, the program…
-
0
votes1
answer262
viewsI need help creating a game like 21
I am working on a game type 21, and I am struggling to create a logic so that the values that the user receives through a draw with random.choice are stored in a list and soon after I display the…
-
0
votes1
answer208
viewsInstantiating a class object in an Input
I’m trying to make a program in python with two classes: Discipline and Room, at a certain point I want to relate the room registered in the class Room in the class Discipline, the code does not…
pythonasked 4 years, 5 months ago João Pedro 11 -
0
votes0
answers15
viewsRestrict type of argument from a Python method
I need to define a class in Python, which will receive a series of parameters. I would like to make the methods receive arguments of a certain type. An example of the code: class Teste(): def…
-
0
votes1
answer262
viewsSelecting two options in the drop down menu with Selenium + Python does not work
from selenium import webdriver from time import sleep from urllib.request import Request,urlopen import pandas as pd from selenium.webdriver.support.ui import Select from…
-
0
votes1
answer203
viewsError - "Required field" in image upload using Django
Guys, I’m developing an application with Django and after organizing the form I went to test the registration and the image upload field always has the same message: "Required field" no matter what…
-
0
votes1
answer267
viewsHow to delete an object in . json using Python?
I use an Excel processing system, which uses Python to make most of its features. I’m having a hard time in this situation: I want to edit a file. json using Python, in particular, I want to delete…
-
0
votes1
answer120
viewsDjango associative table query
Well... I’m trying to do an application on Django for residential energy consumption... I have three tables: Environment, Device and an associative, Appareil_environment where I have foreign keys to…
-
0
votes1
answer100
viewsPower BI and Python - Incomplete Script Result
Hello, I am trying to return the link list found in HTML with the python script below. When run in the Python IDE, the result returns all found occurrences. When running on Power Bi Desktop, the…
-
0
votes2
answers652
viewsPython 3.8 - How to format the display of the elements of a list in column
Hello. My code currently: To fill the list: lista = [] def preenche_Lista(): while True: espaco ="|______" nomeAluno = str(input('Qual o nome do estudante? - Digite FIM para encerrar ->…
-
0
votes0
answers40
viewsDo csg copy a file and rename it then( OS, Shutil)
I’m making an app where I need to copy an image from inside the user’s pc and then play the image in a folder inside a directory that is the program called "/Images". However, even without errors…
pythonasked 4 years, 5 months ago GUI Moreira 29 -
0
votes1
answer32
viewsPython "take not Arguments" error
I was doing a login screen test but there is always an error saying that has no arguments and my login screen is without the part of typing the user and password only shows the window, and I looked…
-
0
votes2
answers564
viewsShow login error messages in Python with Django
I’m building a Python login page with Django, Javascript and HTML. What I’m not knowing how to do is show, on the login screen an Alert with the messages "Unauthorized user" and "Incorrect user or…
-
0
votes1
answer34
viewsHow to group two indexes in a tuple?
I want to group two indices that are received from positions that are results of if’s/Elif’s def MakeListOfFreeFields(board): n_rows = len(board) n_cols = len(board[0]) tfields = () for row in…
-
0
votes0
answers71
viewsDilemma with replace in Python
I am developing a hangman game in Python, and to accomplish the concealment of the word I use this little code: if u1 in e: # Se u1 (Variável que armazena a letra do usuário) for c in…
pythonasked 4 years, 5 months ago Arthur Alberti 29 -
0
votes0
answers297
viewsHow to create a popup view in Django/Python
Hello, I would like to create a popup to see the detailed information when I click on a link, these data should come from a view and recover data from some attributes of my models.py…
-
0
votes1
answer42
viewsWhy user is created but password does not work?
Good afternoon guys I am building a script to create user and password on linux (Ubuntu 16.04LTS). The problem is that after running my script the user is created but I can’t log in with the…
-
0
votes1
answer317
viewsWebscrap with Selenium - How to select content from a drop-down menu item with quotes in id
I see you have a similar question, but the answer still hasn’t helped me. I need to collect data from the Central Bank. For this, I need to download the files that are in a drop down, one at a time.…
-
0
votes2
answers247
viewsPython: requests.get("https://pt.stackoverflow.com/") never returns anything
When trying to use a requests.get(url) I get no response from the server, but adding kwarg timeout=1 for example, I get the answer after 1 second... example:\ import requests url =…
-
0
votes1
answer452
viewsError making a loop for comments on instagram, who helps me? Python Selenium
I need to make a loop that picks up line by line from a file. txt and post as comment on instagram. Through a test I managed to print the first 10 lines of a file. txt arquivo =…
-
0
votes2
answers116
viewsWhy are the commas of the numbers being deleted when importing data with Pandas?
I’m racking my brain to understand why this is happening when I take numerical data from a table on the web. In this table contain the values of the quotations of the coins, the problem occurs that,…
-
0
votes1
answer102
viewsI wonder if it’s possible to decrease my code?
I was doing the following exercise: Write a program that reads a file and shows the letters in descending order of frequency. Your program should convert all entries to Low Box and only count the…
pythonasked 4 years, 4 months ago Fabricio Frazão 13 -
0
votes1
answer58
viewsHow to use i no for value in a function?
I have the following code: select = Select(driver.find_element_by_id('Identificador')).select_by_visible_text('Maio/2019') form = driver.find_element_by_name('Formulario')…
-
0
votes1
answer207
viewsHow to use the Django admin template non my form
I’m learning about Django’s admin site and my question is: I have a modelForm and one of the fields is a foreignKey and would like the change, Edit and delete options as in the Django template (that…
-
0
votes1
answer38
viewsSelectively filling an HTML select from a parameter
I have a Django view that queries the database and returns the result to a "query courses.html" file where a select is populated. view py. def consulta_cursos(request): if campus_id == '605': with…
-
0
votes2
answers319
viewsI made a script that calculates the average of a class or student. But I couldn’t find a way to ask the user if he wants to do another calculation or not
I’m starting in Python, so maybe this looks pretty silly. Basically the code I made gives the option to calculate the average grades of a certain class or a student. I want the program to ask the…
-
0
votes3
answers325
viewsOccurrence of a digit on an integer using Python
Given an integer n, n > 0, and a digit d, 0 <= d <= 9, determine how many times d occurs in n. def main(): ocorrencia = 0 numeroReal = int(input("Digite um número inteiro positivo:\n"))…
-
0
votes1
answer415
viewsRadio button selection - Selenium and Python
Good morning, everyone! I’m trying to extract information from the central bank website using Lenium with python. First let me explain that although there is an API to get the SELIC number, it only…