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
answer822
viewsHow to click a button using Selenium in Python?
I have these codes and I want to click the button Ver link, but I can’t because it’s a div. If you use the submit he skips the task. <div class="btn_site"><br> <div class="btn-dizu…
-
-1
votes1
answer154
viewsPython/Smtp - sending multiple emails
Hello, I am developing an email sending automation for a billing department that consists of checking a spreadsheet for customers who have not made a payment and sending an automatic email to those…
-
-1
votes2
answers128
viewsChange the save location of a Python PDF (pdf.save())
I made a program in Python that at the end generates a PDF with the following data: from reportlab.pdfgen import canvas pdf = canvas.Canvas("vendas_produtos.pdf") pdf.setFont("Times-Bold", 14)…
-
-1
votes1
answer27
viewsHow do I get other users to access my Mysql database with Python?
I am making a program with the mysql-Connector-python library and I wanted other users to be able to access it, because when I start the program on another machine appears the following error:…
-
-1
votes1
answer118
viewsWeb Scraping with Pandas - How to treat values that are null in the collection and how to concatenate two columns in the final result?
I’m making a Web Scrap using Python and Pandas, on Windows. I am collecting the data from the page, generating a Dataframe in Pandas and then exporting to an Excel spreadsheet. I’m not using any…
-
-1
votes1
answer37
viewsPython - Error entering STR given in FLOAT or INT
I am now starting my Python learning and would like to know if there is any way to, by entering a text value in a input type float or string, create a condition that says that a number needs to be…
pythonasked 4 years, 1 month ago Diogo Monteiro 3 -
-1
votes4
answers265
viewsCheck if delta is less than zero (Bhaskara’s formula)
Basically what I need is if delta is greater than 0 should stop and show a message of "There is no root", but I’m not able to put the: D < 0 print('Não existe raízes'). Can someone help me?…
pythonasked 4 years, 1 month ago luciano Bentrup 17 -
-1
votes2
answers81
viewsInsert the values of an N-size vector into the same Python line
Well, I made the following code, which is based on two vectors of size N that, multiplying the values of same Dice form a third vector resulting from this multiplication. n = int(input('')) vetor1 =…
pythonasked 4 years, 1 month ago Gabriel Schrader 45 -
-1
votes1
answer974
viewsAttributeerror: 'Nonetype' Object has no attribute 'text'
Hello I have a code that reads XML, but this XML may or may not have the field vICMSST and so I used a IF whether it is None, thus: import xlrd import xml.etree.ElementTree as ET from itertools…
-
-1
votes1
answer76
viewsReturning the inverse of a recursive sequence of numbers in Python
Well, it follows my code that aims to find the inverse of a list in python through recursive def inverso(n, seq): if len(seq) == 0: return else: ultimo_valor = seq[n-1] print(ultimo_valor, end=' ')…
-
-1
votes1
answer107
viewsAn exercise in python but I could not understand the logic
If you can help me mainly understand I’ll be grateful The functions below constitute part of a library edited into a file, named f_matrix.py and properly installed with path assigned to the list in…
pythonasked 4 years, 1 month ago Victor Hugo 1 -
-1
votes1
answer56
viewsCould you help me narrow the code?
python encrypting, could help me decrease the code? def criptografar(frase): tradutor = "" for letra in frase: if letra in "Aa": tradutor = tradutor + "@" elif letra in "Bb": tradutor = tradutor +…
-
-1
votes1
answer26
viewsWrong value when creating dataframe
I’m looking to create a dataframe with 2 columns - meses and valor. Only the values of the value column are coming wrong. Showing step by step what I am doing: Sum the total of each month of other…
-
-1
votes1
answer108
viewsHeroku does not recognize my Django app
I’m starting my studies with Django and created an application called core within the name Django project django1. After finishing, I decided to deploy it to Heroku with the following step by step…
-
-1
votes1
answer80
viewsShow all possibilities of Python numbers
How do I show all possibilities according to the number of bit quantization, for example: user: 8 levels bits: 3 need to show then: 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 my code so far,…
-
-1
votes1
answer76
viewsHow do I create a Slug automatically from the title of an item created with a Django form
Like the line prepopulated_fields = {'slug': ('name',)} you can generate the Slug of an object automatically just by typing its name in the admin panel. I wanted to do this also when the object is…
-
-1
votes1
answer16
viewsPyside2 // How to change frame without hiding buttons?
I created a window with 4 frames that alternate when clicking the corresponding buttons, but when clicking any button, the frame changes to the corresponding one but the buttons disappear, where did…
-
-1
votes3
answers384
viewsDownload spreadsheet with Openpyxl
I’m struggling to resolve this issue. I’ve done a lot of research and haven’t found a solution to the problem yet. In Python, I use the Openpyxl library to generate a simple spreadsheet in Excel.…
-
-1
votes1
answer78
viewsPython best student lists
supposing I have x students who have had x notes. how do I put the name of the student who had the best grade? # coding: iso-8859-1 -*- import math nAlunos=0 while True: nAlunos=eval(input('Indique…
-
-1
votes1
answer56
viewsUse drop or iloc in Machine Learning modeling in Pandas?
I’m learning Machine Learning for Data Science through Pandas. I made a few algorithms and performed the division of my predictive variables and class as follows: dados = pd.read_csv(...) (...)…
-
-1
votes2
answers150
viewsCross-reference two different dataframes with different line numbers
I have the following dataset df.head() In the column Education degree, I have the values of the indices of each education degree, shown in the table below: Grau_Instr_Bibl = {'Categoria':…
-
-1
votes1
answer131
viewsHow to use Regex to represent a more complex BNF?
I need to create a program with Regex that represents the following BNF’s: <list> ::= <element><list> | <element> <element> ::= <letter><digit>…
-
-1
votes1
answer286
viewsPrint splitters in Python, with their sum in the output
I need to create a program that shows the sum of all the divisors of a number, except this number itself. Ex: the sum of the divisors of number 66 is 1 + 2 + 3 + 6 + 11 + 22 + 33 = 78 In case, I…
-
-1
votes1
answer715
viewsError Typeerror: __init__() Missing 1 required positional argument: 'output_dim' when instantiating convulutional neural network object
I took a course on neural networks applied to natural language processing and now I’m trying to instantiate an object based on the class built in class (with some modifications, because my data is…
-
-1
votes1
answer162
viewsHow can I catch checking the diagonals of a word search?
I’ve already checked some codes here on the site, but I’m not getting it. I am creating a program that receives a word hunt and shows in the terminal where the previously declared words are.…
-
-1
votes1
answer59
viewsRepeat codes with while loop
I’m having trouble executing a noose while within another while. I used the code below, which does everything right, but at the time I type 1 it only repeats the question "Do you want to repeat?…
-
-1
votes1
answer44
viewsHow do you create voids that change the value of a variable without IF? (like Python methods)
To simplify my question, I will show the Bubble Sort in python: def bubbleSort(self): for i in range(len(self) - 1): for j in range(len(self) - 1): if self[j] > self[j+1]: self[j], self[j+1] =…
-
-1
votes1
answer45
viewsPython - Using Threads in Windows for Multiple Events
After I click the Button the window stops responding until the sound ends, and what I wanted it to continue to answer after clicking the button import winsound b=winsound.Beep class janela: def…
pythonasked 3 years, 11 months ago ChickChuck2 51 -
-1
votes2
answers82
viewsPrint letters that are outside of Collections. Counter
I made a code that returns the character recurrence of a file. from collections import Counter with open('hino.txt', 'r', encoding='utf8') as f: conteudo = f.read() counter = Counter(conteudo)…
-
-1
votes1
answer239
viewsHow do I send an error message? Discord.py
Hello, I was making a message with the discord.Embed, only that I want that in case the user does not send the message correctly, the bot send a message Embed error. I tried this way only that the…
-
-1
votes1
answer243
viewsHow to change the color of items in a list in Python?
I am beginning to learn Python and have little knowledge in this area. In order to improve my knowledge, I developed an algorithm for a game of dice that I own. It works perfectly. However, I would…
-
-1
votes1
answer234
viewsRemove XML file line using Python and create TXT file with result
I have several XML files inside a folder that is called FILES and it is local in Windows. All XML files follow the same structure as below: <catalog> <product description="Cardigan Sweater"…
-
-1
votes1
answer36
viewsSelective and Organized Information in Python
I have two lists that send me in real time (ie every second) information if the player is online or offline. def online(nome): # aqui será armazenado o nome da pessoa que está online def…
-
-1
votes1
answer226
viewson_member_join does not work, Discord.py
I was developing a bot and then I decided to create a feature that would receive members and send a short message in your DM. I made the following code: Instance of the Client class: client =…
pythonasked 3 years, 11 months ago Cauê Alves 3 -
-1
votes1
answer42
viewsError trying to create an invoice for Odoo 14 using a third-party module
Hello, I installed a module called "Beauty Spa Management" from cybrosys in my instance of Odoo 14 and when trying to create an invoice for a service the system generates error (it uses the Odoo’s…
pythonasked 3 years, 11 months ago Raymond Najii 3 -
-1
votes2
answers51
viewsHow do I print how many times there is a similar term in a python list?
while True: lista = [] ingresso = (str(input())) lista.append(ingresso) if ingresso== "FIM": break elif ingresso != "NORMAL" and ingresso != "VIP" and ingresso != "FIM": print(f"Comando {ingresso}…
-
-1
votes1
answer59
viewsPython XML query not retouched
I want to make a query that returns the value ['1961'], in the case of "CONSULTATION 2". As the file has several lines, I specified a piece of the XML file. Use this same query "QUERY 2" on other…
-
-1
votes2
answers331
viewsProblem of wget in python
I’ve come to report a mistake that’s causing me to bump my head. I am trying to make a code to download books (pdf) from a Laotian site because it is almost impossible to download all these books…
-
-1
votes1
answer26
viewsI need to know how to achieve inheritance in my python program
from random import randint class PersonagemP: def __init__(self, nome): self.nome = nome self.posicao = str('DEF') self.pontosATK = int(randint(5, 20)) self.pontosDEF = int(randint(5, 20))…
-
-1
votes1
answer71
viewsDisplay Visual Python in Power BI
When using the matplotlib library in Power BI the following error message appears: "Python’s process ended unexpectedly, so the look cannot be displayed. Try running it again." How to solve this…
-
-1
votes1
answer54
viewsIs it possible to inherit a limited set of methods from a super class in Python?
I would like to build a class that inherits only a few methods from the mother class, but not all. To understand what I mean, suppose I have two classes, Person and Student: class Person: def…
-
-1
votes1
answer32
viewsI want to tweet every 240char but not recognized - Python(Tweepy)
I want the show to read. txt, record the 240char and post the tweet, and jump to the next 240char, as if you were reading and posting each line, but instead of serious line by amount of char. But I…
-
-1
votes2
answers71
viewsInclude single board values and show this on the screen without having to repeat boards
How do I print a coordinate without printing multiple trays with the values I typed on the board? tabuleiro = [[0 for x in range(0, 10)] for o in range(0, 10)] print('------------------') print(' a…
-
-1
votes1
answer344
viewsSend Photo to Telegram Bot Python
all good? I am developing a bot in Python. However, in my code I am not able to make him reply with photos. Only message. Ex. I would like to send the message "photo" and the bot send a photo. Can…
-
-1
votes1
answer66
viewsWorking with a python dictionary
I’m trying to resolve an issue in the URI, I’m going to put the description of the issue, and the link, whatever you prefer. Link: https://www.urionlinejudge.com.br/judge/pt/problems/view/1215 Andy…
-
-1
votes2
answers140
viewsHow to generate repeated guesses for the mega sena game?
Good evening! I am very beginner in Python and I am trying to implement a function that generates numbers to be used in mega sena games. However, when executing the said function it returns me the…
-
-1
votes1
answer31
viewsPython3 - How to stop asking for a certain number?
I know that for the present code it is necessary to use a repeating structure, and it can be while one of these. But I couldn’t link such a command to my code. In order to facilitate understanding,…
-
-1
votes3
answers56
viewsPython Problem with exercise
I’m having a hard time doing isPerfect(x) work. I’ve tried some other options but I don’t know if my logical reasoning is wrong. Perfect number A number is said to be Perfect if it is Equal to the…
-
-1
votes1
answer56
viewsPython function prints the result but Return = None
I made a function to solve a sudoku game, the function is working correctly (the game is being solved), but the Return of my function is coming as 'None'. By placing a print on the function it…
-
-1
votes1
answer47
viewsIn Python, check if the contents of one column are present in another column?
I’m at Jupyter Notebook working with Python. My current dataframe is in the following format - data.Columns['name', 'filename', 'text']. All columns are string type, wish, take the 'name' column and…