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
votes1
answer75
viewsNLP Text sorting using Python
I think my problem is text sorting, where I get a string as input, so I need to combine that string with the right choice. I need an accuracy greater than 98.3%. What kind of algorithm do I need to…
-
0
votes1
answer33
viewsFormat timedelta in Django template
I’m having trouble presenting the uptime time of an equipment, Django automatically shows in the following format: I would like to present this time value in Portuguese. in the settings.py Timezone…
-
0
votes2
answers109
viewsInstagrambot: When trying to like instagram photo, class is not found
I started to develop an API for instagram. Everything is working normally, however the line code that like the publication is not finding the class. The class: Code to enjoy: def curtir_fotos(self,…
-
0
votes0
answers19
viewsCustomizing the Django Admin Change Log
all right? I am setting up a system to register accesses and users and need to improve the log list of Admin, so that it presents more information as the value changed and not only which fields were…
-
0
votes2
answers174
viewsFind out which number from 1 to N is missing from a list with N - 1 numbers
Write a function that, given a list of N 1 integers numbered from 1 to N, finds out which integer of that range is missing. Input: The input parameter is an L list of size N 1 containing integers…
-
0
votes1
answer80
viewsI need help understanding this code
I’m starting in python watching video lessons on youtube,the following exercise has been passed: if 10 <= saque <= 600: notas_cem = saque // 100 saque = saque % 100 I DIDN’T UNDERSTAND THESE…
-
0
votes1
answer158
viewsPython application, Pyqt5, not displaying the . UI file?
This program is an application to download videos from youtube, the code is working, but when I tried to call the graphical interface created in Qt Designer, it did not appear. The code did not show…
-
0
votes0
answers14
viewsUsing the getColletion function in Pymongo
some can help me with the following problem? Inside mongoDB, the colletion was created with space, example: "Mkt pipe". mongoDB allowed to do this kind of thing. I created the following route to…
-
0
votes3
answers73
viewsDoubt about storing the function result in a list and the types of stored variables
Home Post I am making a simple code that gives me the variation % between two numbers, A and B. As soon as he calculates this variation %, he should attach the result of the operation in a list that…
-
0
votes0
answers26
viewsStart function in first empty cell per column - Python
I have a portfolio with some shares that I called wallet. I’m calculating the normalized returns on this portfolio by simply dividing the current price of each share by the initial price (base…
-
0
votes0
answers53
viewsCreate a variable having in its name another variable (python)
I’m doing a job in college that consists of analyzing data from covid-19 (through an excel spreadsheet). However one of the questions that my prof. asks is that with indication of a given week the…
-
0
votes1
answer25
viewsSystem Login - Py error
I am new to the world of technology, I work more with HTML and CSS and for pleasure, I study Python. I was trying to do a simple check, but it involved functions. (for study) Where the error appears…
-
0
votes1
answer79
viewsHow can I pass data from one Tkinter window to another?
I have two Tkinter Windows, and I want to pass the dice from one window to the other window. Code from the first Window: from tkinter import * from get_pos_mouse import Get_Mouse_Pos class…
-
0
votes1
answer35
viewsHow to create this type of relationship using Django Models
After seeing a modeling that I should implement in Django, I was a little confused and I will explain what I tried to do and what was sent to me. The following image is the relationship I should…
-
0
votes0
answers37
viewsUse only hours, minutes and seconds on a graph
I’m trying to use the time variables (hour, minute and second) that are organized in columns to make a graph. In addition I have information every 1 second and I need it every 1 minute so I cut the…
-
0
votes2
answers104
viewsI don’t understand why my program isn’t working
I was creating a program that defined which was the age of 4 people if she was male, until then I was able to make the codes that define who is older but when I try to define that the person has to…
pythonasked 3 years, 10 months ago Gustavo Dos Santos Capeletti 3 -
0
votes0
answers49
viewsHow could I provide a set of values of a function in Javascript for a while from Python?
The idea is that while running a while loop in Python code, it will receive a value array of a function in Javascript and will work on those values. Example: In the Python file (in this case, the…
-
0
votes1
answer31
viewsCreating email with text and HTML does not work | Email spacing
I’m having difficulty creating an email on pandas that will send a text and an HTML. Dear, Sending test; • Over the phones: XXXXXX - XXXXXXXXX • TEST Rejected (s): HERE COMES AN HTML TABLE THAT…
-
0
votes0
answers18
viewsIdentify an element in Seleniumchmore Drive if it does not appear to perform a function
Well it makes use of the for to pull the spreadsheet the phone numbers of the whatapp web page and send the message but in some case the phone may not exist, generating an error. I tried to do the…
-
0
votes0
answers27
viewsI would like to know how to capture more than one key being pressed at the same time?
In case I’m wanting to make both paddle move at the same time. import turtle # Function def paddle_a_up(): y = paddle_a.ycor() y += 20 paddle_a.sety(y) def paddle_a_down(): y = paddle_a.ycor() y -=…
-
0
votes0
answers38
viewsPython: I need to get the area below a curve
This is my code: index = 0 T = np.zeros((300,1)) T[:,0] = np.linspace(0.01, 3, 300)[:] A = np.loadtxt('AAA_'+str(index)+'.txt') Tr = 1.0 idx = (abs(T-(Tr))).argmin() a = T[:idx+1] a = [i[0] for i in…
-
0
votes1
answer57
viewsSave python execution as file
I am creating a net gain calculator for Uber driver, so I would like to save the "input" as a text file, Word or Excel. Is there any way to do that? bruto = float(input('\033[0mQual o seu ganho…
-
0
votes0
answers88
views'Object of type 'type' has no Len()' in Django
I am trying to filter the data from a list between two dates and I received this error. Models py. class Data(models.Model): dev = models.ForeignKey(Device,…
-
0
votes0
answers23
viewsPYTHON - Wait for completion of a copy of files before executing the next steps
Hello I am creating a backup routine that consists of copying a series of files from one folder to another. After copying the file I want to run a getsize to recover the size of the directory. The…
-
0
votes0
answers24
viewsHow do I erase that edge on Canvas?
I want to erase this edge that’s around Canvas, but I can’t find which attribute determines its existence. Could someone help me? The code: class Tela(): def __init__(self, resolucao:str): self.inst…
-
0
votes0
answers14
viewsopen zip archive with Python
Hello, I am trying to open a python zip file whose name does not have a pattern. EX: demanda_prd_499118.zip This number changes all the time, keeping only the written demanda_prd Is there anything…
-
0
votes1
answer74
viewsI’m trying to understand these codes, but it’s not making sense to me. Can anyone help me? I’m a beginner
The idea is that the Javascript code communicates with the Python code calling a function and providing arguments, but exactly how it works does not understand very well. Javascript code: set_wheels…
-
0
votes0
answers18
viewsHow to change inlines according to an option in Django admin
Currently I have the following code: @admin.register(Experiencia) class ExperienciaAdmin(admin.ModelAdmin): list_display = ('tipo', 'data_inicio', 'data_fim') inlines = [AcademicoInline,…
-
0
votes0
answers10
viewsHow to use tensorboard projector with cx_freeze?
I am using cx_freeze to generate an executable of two python scripts, a first to create the tensorboard log variables and the second to call and run tensorboard. They work perfectly on my python…
-
0
votes0
answers35
viewsData structure, bag of words, doubts about code structure
Hello! I am studying feeling analysis for the conclusion of a scientific initiation, whose theme is "The influence of social networks on the financial market" In the code are present twitter data…
-
0
votes1
answer202
viewsHow to add columns of different pandas dataframes?
I am trying to add columns between two tables "daily" and "monthly" as a way to update the columns "sum" and "Count". However, for some lines the sum returns empty. The file "diario" has 4800 lines…
-
0
votes1
answer33
viewsOutput of np.Where only back a value
I am developing code to help me analyze import spreadsheets faster and better than the tools excel offers. Basically, I take a spreadsheet, convert to CSV and import pandas and numpy to analyze the…
-
0
votes1
answer81
viewsPython 3 - CSV to Excel conversion problem with list output
Good afternoon. I am facing a problem while converting a CSV file to an Excel file, via openpyxl. The code structure aims to convert a PDF to Excel, and paste the PDF information into a Sheet from…
-
0
votes1
answer142
viewsPycharm displays object class instead of the object itself
Hello, I am training the use of some packages in Python 3.x, and use Pycharm Community 2020.3.3. When I try to customize graphs and tables using packages like pandas and Seaborn Pycharm does not…
-
0
votes0
answers57
viewsBasic programming help in python
Good afternoon, I created a program that needs to sort the numbers and write them in string form, the problem occurs after I order, it seems to be returning an empty list, because when I try to run…
pythonasked 3 years, 9 months ago Victor Araújo 1 -
0
votes0
answers22
viewsQuery Sqlite3 tables using python3 and insert the results in a Treeview in Tkinter
The purpose of the code is to do Sqlite3 searches between two dates and insert these Tkinter Treeview searches. I have the second table in sqlite3: CREATE TABLE "MOTO_PALIO" ( "cod" INTEGER, "data"…
-
0
votes1
answer220
viewsAttributeerror: 'Nonetype' Object has no attribute'latitude' _ Python
I’ve seen some similar questions as mine here, but since I’m very new to Python, I’m not getting around to making my mistake. My program is very short, I simply want to find the coordinates of…
pythonasked 3 years, 9 months ago RAUL GB MENDES 1 -
0
votes1
answer54
viewsPython - Dictionary - Writing and reading correctly
I’m having a problem reading the data from a dictionary I created to save data rebuilt by a function... The dictionary is written whenever the value of Amp and t is rebuilt in loop col. At each loop…
-
0
votes1
answer70
viewsI’m having trouble with the smtplib
The code only works when the subject and message(body) of the email are written in a few letters, I have no idea what it might be. import smtplib import config def send_email(subject, msg): try:…
-
0
votes1
answer145
viewsUsing IF ELSE JINJA2 Python and Flask
I’m starting web development using Python and Flask, I am trying to change the class of a TAG but analyzing the value I am going through to be reinderized follows below how I am doing to try to use…
-
0
votes0
answers19
viewsHow to run a scrapy + Django on Runtime without getting error?
I have a scrapy with 2 Spiders that when running from the command line works perfectly without errors. However, when I call through the application occurs the following: 2021-02-09 12:31:39…
-
0
votes0
answers43
viewsConfusing data output in CSV
I am new in Python and am learning to analyze and write CSV files. I’m stuck in a problem I haven’t been able to solve for a few days: I’m trying to read a government database, also in CSV, take…
-
0
votes1
answer46
viewscss class using jinja2 does not work
I’m trying to put css styles but just took the first block of code in my css style. css style. h1 { color: blue; } .login { display: inline-block; padding: 15px; border-radius: 4%; text-decoration:…
-
0
votes0
answers39
viewsDiscord.ext.Commands.errors.Commandinvokeerror: Command Raised an Exception: Nameerror: name 'ctx' is not defined
I’m trying to make a command that shows the avatar of the person who summoned him inside a embed. So far the code is this: @client.command() async def avatar(message, *member : discord.Member):…
pythonasked 3 years, 9 months ago user222821 1 -
0
votes1
answer98
viewsWeb Scraping with Webdriver and python Selenium
This program aims to download excel files to optimize time. But there are the filters to be filled before downloading the file, in these filters have the start date and end date, it must be the same…
-
0
votes1
answer88
viewsHow to get the current user in the HTML page to insert in the Flask Python database
Hello I need to get the user who is logged in to the system for when he does an Update or Insert in the database enter his record, currently in the template I can already get the user name with this…
-
0
votes2
answers58
viewsInsert values into an array with dimensions defined from a loop
Good afternoon, I am trying to save values in the form of an array from different text files, using a loop. I need the values obtained from the first iteration to be stored in the first line of the…
-
0
votes0
answers86
viewsIs there another way to access the index of a Python list?
I want to know: There is another way to access the index in question, where I am using in print()? Guarded in 'dice' the respective values, but because they are decimal, I’m having difficulty…
pythonasked 3 years, 9 months ago Daniel Alves de Barros 21 -
0
votes1
answer341
viewsWhat does this error mean and how to fix it: Eoferror: EOF when Reading a line?
The code I was testing worked perfectly in the visual studio, however, by submitting on one of these sites similar to the URI, that error appeared. I know it is a line reading error, but I could not…
-
0
votes1
answer105
viewsAdjusting axis values on a Python chart
I’m trying to pull the white squares out of a graph in Python (using a Jupyter Notebook in Anaconda). I would like the xx axis to end at 1.3 and the yy axis to end at 1.2. I tried to adjust it with…