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
answers100
viewsPython language 3.7.3 : Filenotfounderror: [Errno 2] . .
Good morning. I have the following code in a class that works perfectly well when I print inside it. Now when access through another class file presents me error. Below demonstrate class that works…
python-3.xasked 5 years, 1 month ago João Carlos 49 -
0
votes1
answer67
viewsTkinter.filedialog does not work with Toastnotifier
I am creating a virtual assistant that communicates with the user through notification messages. I researched a lot on the internet about and found the win10toast. So far the program is working…
-
0
votes1
answer404
viewsForeignkey of two tables in Django
Fala, Povo! I have the following problem: I am developing a site for a store that also performs services. Then I have the Shopping and Sales Table (Saleorbuy) and the Services Table (Service) For…
-
0
votes0
answers149
viewsHow do I get the angle of an image gradient, using Python and Opencv
I need to get the angle of the gradient of an image, I’m programming in Python and using Google Colab for the codes. I found this code here, which should show me the angle of the gradient: import…
-
0
votes0
answers38
viewsDjango form that varies according to another form
How do I create a form in Jango of an object and that the price of the object varies according to the size of the object without having to update the page. #py.models class Pizza(models.Model):…
-
0
votes2
answers306
viewsPrint only palindromic words
Training python, I was able to make a program that checks if the input is a palyndrome word. Follow: def palindromo(texto): if len(texto) <= 1: return True else: return texto[0] ==…
-
0
votes1
answer28
viewsFutsal (error) - Python
Good people, I’m making a futsal code and I’m having certain obstacles with it. Currently, I am studying Python and for the first time applying POO, so I need you to give me a light on how to…
-
0
votes1
answer134
viewsLoop to perform quantity processes in quantity
I have a size 30 list in python, I need to make a loop to catch 6 item from that run list, after we finish the 6 run over 6 and so on until finalizing the list. but I’m not finding a way to do that.…
-
0
votes1
answer507
viewsWeb scraping with python on authenticated websites
I am trying to automate a web data collection process using Python. In my case, I need to pull the information from the page https://app.ixml.com.br/documentos/nfe. However, before going to this…
-
0
votes1
answer36
viewsVector does not print completely - Python, Opencv
I’m working on a Python project using Opencv, I’m running on Google Colab. I want to save the markers vector from an image of a segmentation method, but whenever I print the vector, it appears…
-
0
votes1
answer904
viewsError Noreversematch
Hello, I have the following error in an application in Django. Noreversematch at /Row/Details/2 Reverse for 'get-weatherdata' with keyword Arguments '{'rowId': 1, 'sensorId': 1}' not found. 1…
-
0
votes1
answer189
viewserror in openCv Python drawContorns
I’m trying to paint the contours of an image. Follows the Code: import cv2 import numpy as np img = cv2.imread('./assets/placa.jpg') cv2.imshow('texto', img) # trasnformando a imagem em cinza para…
-
0
votes2
answers65
viewsPrinting words or phrases from a text
Hello, guys, I’m a beginner in Python. I’m learning alone and I’ve done some programs, which is pretty cool. But I’m trying to make a new program and I’m not getting it. Here’s the thing: I have a…
python-3.xasked 5 years ago douglas1alc 23 -
0
votes1
answer1662
viewsReplace Nan value in dataframe with a string
Hello, I’m developing a small Dataframe that stores the name and symbol of some acids. I have already made the code that generates Dataframe as two separate series and concatenate them in the DF…
-
0
votes1
answer509
viewsHow to Serialize more data from more than one table in Django Rest-framework
Speak People! I am the following problem: I have a buy-and-sell schedule: class SalesOrBuy(models.Model): client = models.ForeignKey(Client, null=True, on_delete=models.CASCADE) mode =…
-
0
votes2
answers400
viewsGlobal variable for Python directory storage
Good afternoon Personal, I am creating a program in python using the Tkinter GUI that use several screens and in the GUI configuration I need to call some text and image files. I would like the help…
-
0
votes0
answers63
viewsUnderstanding Code for Study Purposes (OBI - Python)
I would like to understand an algorithm about OBI 2017 - Cutting Paper link: https://olimpiada.ic.unicamp.br/pratique/pu/2017/f2/papel/ cannot understand why at the time of making the paper cuts he…
-
0
votes1
answer474
viewsTransform excel file into array - python
In the code below I am assigning values within the code itself, I tried to pull the values directly from excel using pd.read_excel, but I don’t know how to turn it into an array for this code to…
-
0
votes2
answers235
viewsHow to Update to a DB Sqlite3 with POO?
I have a product registration program with everything working only I lack the update, I can update edit the data in the table and in the bank but it is not working right. It edits all the data and…
-
0
votes0
answers37
viewsHow to implement python decorators to reuse code from a function?
Guys I’m trying to learn about decorators to help automate some repetitive routines. Initially, I have several functions that read files and transform each line of them into a Pyhton list depending…
-
0
votes1
answer729
viewsError: No module named 'email.utils'; 'email' is not a package
Hello, any script I run, returns me the following error. /bin/python3 "/home/Hofferman/Scripts Python/Untitled-1.py" 1 ↵ Traceback (most recent call last): File "/home/Hofferman/Scripts…
-
0
votes1
answer569
viewsError reading a column of a file . xlsx using Python pandas library
I need to create a Python list from a column of an Excel file using the pandas library. I have already installed all library components and the files are in the same directory. from pandas import…
-
0
votes3
answers752
viewsHow to convert int variable to string without deleting zeros?
Need to perform in an activity the validation of characters typed by the user. My code: mes1 = int (input ('Digite o mês inicial:')) valida = len (str (mes1)) while valida != 2: print ('Valor…
-
0
votes0
answers23
viewsWhat does the asterisk next to a letter in the vector argument, why this in the code?
What about you guys? , I’m studying about vectors with the pygame python library and I don’t understand why an asterisk next to the letter A in the vector defined in the position variable down in…
python-3.xasked 4 years, 12 months ago Eduardo 415 -
0
votes0
answers29
viewsSpecific type for attributes
I’m trying to define the type of information that attributes receive, but I’m not sure how to do it. I tried these methods, but they do nothing. class Lancamento: def __init__(self, tipo, data,…
-
0
votes2
answers339
viewsHow to save the result of this code in a list?
I made the following code in python: def exibir_menu(): print('''Escolha uma opção: 1. Cadastrar um aluno 2. Listar alunos matriculados 3. Procurar um aluno ''') def cadastrar(pessoas): nome =…
-
0
votes1
answer139
viewsError running Keras.models.Sequential() with tensorflow
I imported Keras.models as specified in the documentation Importing: from keras.models import Sequential When creating the model I try to run Sequential returns an error: Execution: model =…
-
0
votes1
answer205
viewsStore data from a variable that changes value at each instant
Hello, I’m trying to solve a problem that involves your questions. I’m using a python api to get data from the IQ Option investment platform, but I’m unable to work with the data. If I do dados =…
-
0
votes0
answers37
viewsString assigned to a variable that is not in a list
In this code below I want Python to return me the traffic signal of 4 simultaneous traffic lights. As the results are random, sometimes it returns me the correct that would be: One headlamp with…
-
0
votes1
answer108
viewsSend input to save to JSON file
I have a screen where there is an auto-complete for sale items, the user searches the item by name or code, so far everything works. I need to capture the chosen item and send it to backend (Django)…
-
0
votes1
answer430
viewsError "Indexerror: list assignment index out of range"
This program when executed a certain amount of times it shows a message shown right below. Agent Train 1 def Ttrem_Um(velocidade,linhas): velocidade = randint(55,100) return velocidade Agent Train 2…
-
0
votes1
answer509
viewsDownload images from a python txt(links) list
First I imported the packages and created a class and its settings: class Scraper: def __init__(self): self.visited = set() self.session = requests.Session() self.session.headers = {"User-Agent":…
-
0
votes0
answers48
viewsModule does not find def attribute
I have to find in the question, the email and wpp by the name that is inserted, and I need to put it in a def in task.py for example, I did so so: import __init__ def encontrar(elemento): pos_i =…
-
0
votes1
answer39
viewsSave Timefield as blank
I have a function to save the data imported from excel, the problem is that I have a Timefield that can come blank, and with that I have the following message: Error saving object to database:…
-
0
votes1
answer627
viewsTypeerror: 'Autotrackable' Object is not callable
I am trying to use an imported tensorflow_hub model as shown below: #%% from sklearn.model_selection import train_test_split import tensorflow as tf import tensorflow_hub as hub from keras import…
-
0
votes0
answers33
viewsHow to search for array in postgres through sqlalchemy?
My database has a column like ARRAY(sa.BIGINT). My intention is to use the command filter_byof sqlalchemy to search for an element that has the list_secao_id field equal to [58,45,12], for example:…
-
0
votes2
answers483
viewsaccess field value within Django template
You can access the values within a variable in Django templates? For example, I have this model: class Avaliacao(models.Model): post = models.TextField() data_inclusao = models.DataField() in the…
-
0
votes0
answers28
viewsProblem while extracting zip file - Zipfile
Remaking the question in an attempt to make it clearer. A webhook calls my API by sending a POST request. On the request body contains the url of a ZIP file. Using the requests library, I perform a…
-
0
votes1
answer1735
viewsCalculating the average and weighted average with For
because I’m making the mistake File "", line 50 print ("This is the sum of the products between the samples and their respective weights", Pixi)" ^ to calculate the weighted average with the user…
python-3.xasked 4 years, 10 months ago Kioolz 192 -
0
votes2
answers107
viewsHow to partition people in a network of friends?
In your class, many students are friends. Let’s assume that two students who share a friend should be friends; in other words, if students 0 and 1 are friends and students 1 and 2 are friends, then…
-
0
votes1
answer388
viewsHow to loop python code, unittest, Selenium?
Following the code, how to proceed in a loop to always repeat the same fill N times? Or even picking up the names from a list. txt and populating in "name"? def teste(self): driver = self.driver…
-
0
votes2
answers123
viewsHow to find a string in a python txt
I wanted that with this code I could go through my txt file and show all the same words (which is autonomy). I don’t know if it’s possible and the only way I can is to make a…
-
0
votes0
answers108
viewsOserror NLTK Forest labeling
I’m doing tests with NLTK for chatbot, and I ended up having an error when I tried to tag a phrase using the Forest after mining data from the internet (this error is also when I tested without the…
-
0
votes1
answer417
viewsHow do I check if today’s date matches a date created in a Django application?
I have an app that gets the day of the week and the time when an event should occur. In addition, it also receives the period of time that people must confirm presence. My model goes below: def…
-
0
votes0
answers125
viewsHow to get all files used on a page using "requests"?
As we know, when accessing a website by browser, various files such as images, music, scripts, CSS, among others, are downloaded to be used within a page HTML. Using the library requests, it is…
-
0
votes1
answer146
viewsPyqt5 Changing the order of items added within the Qlistwidget
Hello I was wondering if it is possible to change the order of entries of the items within the Qlistwidget, Currently when I insert a new item within the Qlistwidget it and fixed at the top and the…
-
0
votes1
answer3100
viewsHow to check if part of a string is contained in a Python list?
I am writing a Python3 script, in order to place a filter to prevent the user from passing a string containing an offensive or improper word. So I created a list containing the words I want to put…
python-3.xasked 4 years, 9 months ago Michael Mattos 19 -
0
votes1
answer392
viewsLimit number of characters per Dataframe Python column
Need to limit the number of characters per column in Dataframe to Insert in SQL Server. Example: I have a Dataframe with 3 columns and 1k of rows (Column J/ K/ L) and I need to limit the Dataframe’s…
-
0
votes1
answer74
viewsOperating on a list of lists with the conditional
I’m trying to use list comprehension in a code but I "zipped" in using the structures for and if in a certain part. Can someone help me? Basically I have a list called "sup" whose 2000 entries are…
-
0
votes2
answers83
viewsHow to specify different precision for different values in python
Hello, I am trying to print values with different decimal accuracies, but even after attempts and researches, I could not find a solution. The code snippet with this problem is: valor_monetario =…
python-3.xasked 4 years, 9 months ago Franklin Sousa 11