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
-
0
votes0
answers57
viewsBeautifulsoup is returning None
I’m trying to get the title of a product on the Amazon website, but the value returned is always None. Product link:…
-
0
votes0
answers134
viewsIs there a better way to implement collision in the pygame?
I’m making a game, like Arkanoid. The physics of collision between objects and the screen are great. The "colliderect(rect)" method works, but when the ball hits the batter’s sides, the ball instead…
-
0
votes3
answers52
viewsHow to fill out a list?
I need to fill out a list (without using packages like numpy or pandas) that has a format similar to the following: lista1 = [0, 3, 7, 10, 15] The numbers are increasing but do not follow an order…
-
0
votes1
answer20
viewsError regarding guidance on building modules in the Head First Python book using Windows
Hello! I’m reading the book Head First Python and a question arose regarding the creation of module and distribution of it using Windows. Following the author’s guidelines, I created a.py file with…
-
0
votes1
answer44
viewsCount based on the value of a field and index filter in Elasticsearch with Elasticsearch-dsl
I’m using Python3.6, with elasticsearch (7.9.1) and elasticsearch-dsl (7.3.0). On my index logstash-2020.09.21 i have some documents as below (filtered by the relevant fields): { "subtype":…
-
0
votes1
answer66
viewsWhat could I do for that except not to interrupt my Else?
This is my line of codes, I wish this except didn’t interfere in my last This, but in all the ways that I tried, went wrong. #frameworks usados import pandas as pd from pandas import DataFrame…
-
0
votes2
answers107
viewsImports in Python 3
Hello! I’m having a very recurring problem regarding "custom" module Imports in python 3 I’m doing a project of a very basic game thing myself and so far this is the structure of my project: game/…
-
0
votes1
answer74
viewsPython - How to get the date of the last Google Spreasheets update?
Personal talk! Next, I needed to check if there were any updates to the Google Spreasheets shared document. I thought I’d bring this field: as a date or as a timestamp in python and check with the…
-
0
votes0
answers22
viewsPlotting of graphics in Iteration
Good afternoon, Contextualizing, This is a study of control charts from the Tennessee Eastman Process dataset. The IDV below is corresponding to n° of the fault I wish to plot. Without the iteration…
-
0
votes1
answer54
viewsShow UTC time in an Entry Widget
I would like and was trying a way to show the time by updating myself, through an entry on Tkinter. I set up a function for this but I can’t get it to appear in Entry, instead it appears "Function…
-
0
votes0
answers150
viewsHow to solve the "Exceeded Time Limit" in this code?
Input format : The input consists of a series of pairs of integers i and j, a pair of integers per line. All integers will be less than 1,000,000 and greater than 0. Note that the entry only ends…
-
0
votes0
answers77
viewsOpencv with Python error occurs "Assertion failed"
I recently started working with Opencv in Python. Well, I’m making a code here and, when compiling, gives the following error: Ocorreu uma exceção: error OpenCV(4.4.0)…
-
0
votes1
answer327
viewsNameerror: name 'pytesseract' is not defined
I am using the Pytesseract and Opencv libraries to print a text from an image, but when trying to run the script it gives the following error: img_text = pytesseract.image_to_string(img)…
-
0
votes1
answer48
viewsHow do you know if the phrase is on the list?
I want the message "Uhul! Your secret friend will love", but the variable present always gives as answer "Try Again", example: in the variable 'personal gifts' I type 'pedro camisa keyboard chair',…
-
0
votes1
answer297
viewsError 1064 mysql in UPDATE function
Guys I’m having a problem with the command on UPDATE, I’m using Python 3.8.5 and mysql 5.7.31. value_id = 10 value_column = 'nome' ID = 'rodrigo' comando_sql = "UPDATE user SET %s='%s' WHERE id=%s"…
-
0
votes0
answers74
viewsFilter combobox according to the list of projects created by each user logged in to Django
I’m new to Jango and I have a lot to learn. I’m developing a system in which the logged-in user registers their requirement, but each requirement is tied to a project that the same user created. As…
-
0
votes1
answer331
viewsInfinite registration of client
I’m studying Python and decided to create a small terminal registration program, but I can’t make a loop that goes through all the options, the program is interminably in the client registration.…
python-3.xasked 4 years ago ANDRE LUIZ BRAGA MALLMANN 9 -
0
votes0
answers51
viewsHow to use pyplot broken_barh using dates? Because I want to plot a Gantt chart
import matplotlib.pyplot as plt from math import floor def tamanho(lista): return floor(len(lista)/2) rangex = [[(0,1.5)], [(1.5,3)], [(3,3)]] rangey = [(n, -.5) for n in…
-
0
votes1
answer79
viewsRun event on Tkinter button
I’m having trouble getting the button to run a def and make a simple encryption and then display on the screen. import tkinter as tk from tkinter import * class Application(): def __init__(self,…
-
0
votes1
answer45
viewsHow to detect functions in the browser
I am developing a web scrapper in python that will take the data of a stock chart every 30 min and send me an email telling me if the action has varied positively or negatively, however, I got the…
-
0
votes1
answer27
viewsStoring values in a function to be used later
Hello guys I’m having a problem, I’m wondering if in Python 3.x would have the possibility of a function to store a previously defined value for later use at another time of the code. As shown in…
python-3.xasked 3 years, 11 months ago LucasRussi 37 -
0
votes1
answer27
viewsIs it possible to return all ids from an Elasticsearch search keeping the specified `size`?
It is possible to return all ids of an Elasticsearch search? I have the following query that most of the time returns in the field ['hits']['total'] more hits than what I specify on size. As in the…
-
0
votes1
answer30
viewsHow to include a value in a matrix by separating a digit in each column?
I developed a program that, when informing a value, this value is allocated in all columns of the row, returning me an array like this: array([[0, 0, 0], [233, 233, 233], [0, 0, 0], [0, 0, 0], [0,…
-
0
votes1
answer203
viewsException Treatment does not work when dividing by zero
I need to read a set of values and report the division between them, regardless of whether they are positive or negative. The problem says that if there is a division by zero a message should be…
-
0
votes1
answer61
viewsConvert a sqlalchemy query to a dictionary - Python
I have this consultation made with SQLalchemy ORM, where table_schema contains an example of sqlalchemy column nq = session.query(Base.table_schema).filter(Base.tablename == 'stores').scalar() The…
-
0
votes0
answers29
viewsHow to resolve the following output:Did you Mean to set reuse=Tf.AUTO_REUSE in Varscope?
I am studying AI with tensorflow, but am facing the following error: Valueerror: Variable generator/Dense/kernel does not exist, or was not created with Tf.get_variable(). Did you Mean to set…
-
0
votes1
answer200
viewsDjango Error 3.1.3 Reverse for 'post_detail' not found. 'post_detail' is not a Valid view Function or Pattern name
Python 3.8.3 Django 3.1.3 I don’t understand why this mistake is happening. Reverse for 'post_detail' not found. 'post_detail' is not a Valid view Function or Pattern name. The line the error…
-
0
votes0
answers22
viewsHow to get the Qlineedit name that is focused on Pyqt5?
I created 5 pages with Qt5designer, each page has several Qlineedid. I switched to python. The application gets very extensive and repetitive. I need to simplify capturing the name that is in focus…
-
0
votes2
answers63
viewsHow do you compare an item with all other items in the same list (with dictionaries inside) in a pythonic way?
I’m a beginner, guys. Just for the record! I am trying to compare the items on a list with dictionaries and if they are equal, add these items. I think with one example, the idea becomes clearer:…
-
0
votes1
answer35
viewsThere is no error in the execution of the code, however the return I am having in the excel table is that is the problem
I have a problem returning my code. I do not get any error in the execution, but the problem is the return in the Excel table. I’m doing a case study of my college and the system is about customer…
-
0
votes1
answer1304
viewspyodbc.Interfaceerror: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Name of data source not found
I am creating a code to perform an adjustment in a sql server database, but when trying to run it is returning error: pyodbc.Interfaceerror: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Name…
-
0
votes1
answer124
viewsHow do I call an asynchronous corotine within a function that is initialized into a thread?
import telepot, time, threading, asyncio from telepot.loop import MessageLoop from datetime import datetime from telepot.namedtuple import ReplyKeyboardMarkup, KeyboardButton, InlineKeyboardMarkup,…
-
0
votes2
answers93
viewsDate change of a monthly average of Pandas
Hello. Using the code below I perform a monthly average, but it is fixed on the last day of the current month and I would like to know if it is possible to configure it for a fixed day of the month…
-
0
votes1
answer32
viewsHow to make the program recognize a name with spaces next to a float?
Code: compras = {} soma = 0 while True: dados = input().split() if dados[0] == '*': break else: compras[dados[0]] = float(dados[1]) while True: comandos = input().split() if comandos[0] == 'total':…
-
0
votes2
answers157
viewsDjango: Css not imported
I am developing my first site with Django and I came across a problem: While running the browser application, as changes contained in the css file do not apply to the website when I try to import…
-
0
votes1
answer64
viewsfind a word in a random character list
I need help in this python exercise Marlon likes to cut letters from his magazines, then reorganize them to form sentences. Once, he cut out the letters ZEPUAMAOIZ and realized that changing the…
-
0
votes1
answer544
viewsTypeerror: 'int' Object is not iterable
def add_divisors(list_num): final_list = [] for number in list_num: final_list.append([number]) for sublist in final_list: for number in sublist: for x in range(1, number + 1): if number % x == 0:…
-
0
votes0
answers10
viewsHow to repeat a code at the end?
Hello, I’d like to know how to make this code repeat at the end, I know it may seem simple but I haven’t found anywhere the answer var = int(input('Insert: 1 for +; 2 for -; 3 for X; 4 for /; 5 for…
-
0
votes2
answers355
viewsFloat to str conversion without losing two decimal places and changing decimal separator
In Python, I need to convert a float to string and replace the point by comma, without losing the two decimal places. I have tried several ways, but could not. In doing: >>>…
-
0
votes1
answer52
viewsPyside2 error when using Qwidget.render() method, how to bypass?
I am having trouble printing a widget. When executing the code below an error is returned. #p é uma instancia QPrinter painter = QPainter(p) painter.setRenderHint(QPainter.HighQualityAntialiasing)…
-
0
votes0
answers38
viewsWhat is the correct procedure for installing the PYGSLIB library?
Anaconda had been installed with version 3.8 of Python, but was unable to install the specific library, the following error occurred: UnsatisfiableError: The following specifications were found to…
-
0
votes1
answer43
viewsHow to call a function by loading a string in Django?
I’m new to Django and I’m testing, In case I have my.html posts and wanted to load all posts summarized on the page, but one side would load the posts with id pair and the other side with id odd. I…
-
0
votes0
answers51
viewsError generating python exe with pandas-gbq
I am trying to convert a font to exe. Type the command: pyinstaller --onefile arquivo.spec Shows that it was performed successfully, but when I click on exe, the message appears ImportError: Missing…
-
0
votes1
answer45
viewsReplace multiple substrings of a dictionary
I’m trying to make a replace, but I’m not getting it. My code: dicionario = { "uva":"R$ 5,00", "abacaxi": "15%", "abacate": "preço: N/A" } for key, value in dicionario.items(): if 'R$ ' in value or…
-
0
votes0
answers47
viewsGif with Tkinter
I have a problem here.. I’m trying to make two gifs stand on top of each other when called, simulating a sensor. When it doesn’t detect anything, it shows a gif, when detected, it shows another gif…
-
0
votes0
answers24
viewshow to join 2 lists in a third list?
what I wanted is a third list to receive the content of the other two but putting together and on the same list, like: a = [1, 2, 3] b = ['ola, mundo', 'oi'] c = [[1, 2, 3, 'ola, mundo', 'oi'], [],…
-
0
votes1
answer26
viewsProblems running Buildozer kivy
Could you help me? I am several days trying to run the buildozer on the virtual machine configured by the kivy itself, however all the solutions I found on the net and implemented, returns me the…
-
0
votes1
answer29
viewsError using a bot in python
Whenever I run the following code (using python) from chatterbot import ChatBot from chatterbot.trainers import ListTrainer bot = ChatBot('bot1') bot = ChatBot( 'bot1',…
-
0
votes0
answers73
viewsHow to execute a query using Python function
I set up a function that connects me to the BD and returns me a query: def consult(self, query): try: conn = mariadb.connect( user="XXXXX", password="XXXXX", host="192.168.000.000", port=3306,…
-
0
votes0
answers20
viewsError connecting to a DB in Python
I’m having trouble connecting to a database by a script I developed in Python. It’s probably some logic error involving the variables I couldn’t decipher and I wish someone could help me. This is a…