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
answers13
viewsGroupby with pandas and matplotlib
How to group the total value of y per year x and plot? x = df_Year y = df_RevenueMillions plt.plot(x, y) plt.show()…
-
0
votes1
answer101
viewsConstant click using Selenium does not work
Goal: Click 4 times on the same button "See More" Problem: Click command works the first 2 times, after that, it no longer works and returns TimeoutException Code: ops = webdriver.ChromeOptions()…
-
0
votes1
answer163
viewsHow to use user-clicked button text as input in Tkinter?
I would like to use the text of the button clicked by the user of my game to make a logical test and return another question to the user. The game will work with a sequence of these questions, and…
-
0
votes0
answers26
viewsI’m studying about python /Jango and I came across a from and an import called "Rating" could someone explain to me what it’s for?
def show_scoring_average(self): from .Rating import Rating # Gostaria de entender esta linha try: ratings = Rating.objects.filter(user_rated = self.user).aggregate(Sum('value'), Count('user')) if…
-
0
votes0
answers16
viewsReplacing data in lists
def substituir(lista,velho,novo): lista = [1,2,3,3,5] resultado = substituir(lista[velho],novo) return resultado The problem is that I can’t replace an old list item with a new one. For example if I…
-
0
votes1
answer257
viewsPython/Mysql - Exporting CSV files
Hello, I am developing an application to extract files from my database, in csv. The file is normally generated with the data that is in the database, but if I insert more data into the database, it…
-
0
votes1
answer433
viewsMaking queries in the bank through form using Django
I am starting studies on the use of the Django framework and I am trying to query the database using a form to return a specific value in the database. Follow my template: <form method="GET">…
-
0
votes1
answer23
viewsI have a problem at Vscode Terminal
v = float(input('Valor: R$ ')) b = 5.33 print(f'U$ {v * b:.2f}') When I make some input code, give an error in the terminal after some time without typing something. Erro: invalid literal for int()…
-
0
votes1
answer20
viewsMigrations from my Django app are not applied
I created the models.py file in my app, created all the models, added appConfig to INSTALLED_APPS but when I use the manage.py migrate myapp it does not make any changes to the mysql database: Can…
-
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
votes2
answers53
viewsRegression curve with x-axis equal to 0
How do I find the value that cuts the x-axis of a regression line as shown in the graph below My dataframe has the following structure: total_da_carga data_ordinal 21708 737061 24845 737062 22696…
-
0
votes1
answer45
viewsPrint value of a dictionary
I have this issue to resolve, I need to display the note of the first name in the order of the flame, but I can only print the Key, the question is this: Make a program in python that prompts the…
-
0
votes0
answers22
viewsIs it possible to establish a download directory with urllib.request.urlretrieve?
I am trying to set a default download forwarding directory after using urllib.request.urlretrieve, to avoid having to move the file with and shutil. Does anyone know if it’s possible and how to do?…
-
0
votes0
answers10
viewsProblem with terminal printing
I would like to print 3 lines in the terminal, but I wanted these 3 lines to update without cleaning the terminal, because my program will have an input below and when I clean the terminal is giving…
pythonasked 3 years, 3 months ago Richard Alexsander 1 -
0
votes0
answers20
viewswhat is the purpose of __init__ and super() arguments in Python?
I’m programming an app with the kivy, and the instructor talked about these arguments, only he didn’t explain what exactly they do, someone can explain to me what they do??
-
0
votes1
answer41
viewsTypeerror in INSERT via Python in Postgresql
I have the following code import json import io import psycopg2 connection = psycopg2.connect("dados da conexão") connection.autocommit = True cursor = connection.cursor() readTest =…
-
0
votes2
answers274
viewsLimit the amount of decimals of a floats values that fill a list
Hello Stackoverflow community, good morning. I’m trying to develop a code that calculates the numerical values obtained from a physics equation Here is the form of the equation, where k , T and pi…
-
0
votes1
answer18
viewsCheck if two keys were pressed at the same time python
Hello guys I’m using python and the pynput.Keyboard module to check keystrokes until then everything ok, but I would like to know when two keys were pressed at the same time: example Shift+L or any…
-
0
votes0
answers10
viewsDjango with bootstrap
bootstrap does not load on Jango via Cdn
-
0
votes0
answers17
viewsWhen I call python Manage.py migrate from this problem and because of pycham?
When I am to test the database (Sqlite3) always gives this same error. remembering that I am not using a database for production, because this system is only for training.…
-
0
votes0
answers18
viewsVscode Studio does not recognize external modules
Hi. I went to Visual Code Studio to try to import the requests module. An external python module. The problem is that Visual Code does not recognize this module, and no other external module from…
pythonasked 3 years, 2 months ago Nicolas de Sena 1 -
0
votes3
answers149
views(Python) How to prevent methods from being accessed from the value of some attribute
It may not have been very clear about the title, but I wanted it only to be possible to use a method on an object if one or more of its attributes are in a certain way. For example: A TV class that…
pythonasked 4 years, 10 months ago Cachorro_louco 63 -
0
votes1
answer334
viewsHow to do a file search using Python
Problem: Implement the function search(), which accepts as input the name of a file and the path of a folder, to search for the file in the folder and in any folder contained therein, directly or…
-
0
votes0
answers9
viewsView pdf file using python
How do I open and view a pdf file using python? literally I want to by open code using something similar to windows Acrobat Reader reader
pythonasked 3 years, 2 months ago Vini Silva 1 -
0
votes0
answers21
viewsHow to do error handling where it will only be possible to insert numbers?
import math print('Insira comprimento do Lado \"C\":') lado_c = float(input()) print('Insira comprimento do Lado \"B\":') lado_b = float(input()) hipotenusa = math.hypot(lado_c, lado_b)…
pythonasked 3 years, 2 months ago Ronaldo CNC 1 -
0
votes0
answers10
viewsManually create error bar in Seaborn
I have the error of my calculated data and want to use this information to plot an error bar on the graph. I saw that Seaborn makes automatic, but I want to use my estimate. I’m using the lineplot…
-
0
votes2
answers330
viewsWeb scraping of a microsoft form Forms returns None [python]
Hello, I’m having difficulties in making a web scraping of a form made by microsoft Forms. (NOTE: The form was made by me). I have the following code: from bs4 import BeautifulSoup import requests…
-
0
votes0
answers16
viewsHow to get user input before they press Enter
Guys, I wanted to know how to get the raw user input, before it presses Enter, well what I want to do is, using Threads I listen to a TCP client, when it sends data, I wanted it to overwrite the…
-
0
votes0
answers18
viewsLists and file in Python
Hello I am making a system for inventory control but criterion was asked by my teacher to store the stock data in a list and store it in a file and I have no idea how to do that.
-
0
votes0
answers4
viewsmultipe Connections Servers/database postgres with python
I am a student python basic language yet and I would like to Learn how to connect in multiples Servers and database postgresql through sql query. I have 9 Servers and 200 Databases with same…
-
0
votes0
answers9
viewsWidevine problems in cefpython3, for Netflix and Spotfy. Python
I’m making a browser with cefpython and I’m having problems with Widevine, to access safe content. I was wondering if anyone has solved this problem for python. I only find solutions for c++ or c#…
-
0
votes1
answer32
viewsError when adding a text with Django 3, how to fix it?
from django.db import models class Topic(models.Model): text = models.CharField(max_length=200) date_added = models.DateTimeField(auto_now_add=True) def __str__(self): return self.text class…
-
0
votes1
answer107
viewsmatplotlib -> Could not load source '<__array_function__Internals>': Source unavailable
I am having this problem when using plt.show() or plt.savefig('/path'): The same error occurs when I try to plot a simple graph: import matplotlib.pyplot as plt plt.stackplot(range(4), [2, 2, 2, 2],…
-
0
votes0
answers16
viewsDetect requests from a website with python
Do you know when we select the Developer mode of Chrome and see all the Urls that a Certain site requests and that can be Seen in the network tab? I Wanted to do the same but with python. I would…
pythonasked 3 years, 2 months ago Diego Castro 1 -
0
votes0
answers30
viewsDo you need python installed to build a Docker image?
On the Docker website, examples of build with Python, Java, Go, Node.js(javascript) are given and they are indicated to have previously installed them. What do I see, I have to have the language…
-
0
votes1
answer146
viewsRead binary file using struct created in C++
Good afternoon to all, I would like to read a binary file created in C++ using the following structure: struct STRUCT_MOB { char MobName[NAME_LENGTH]; // The name of the mob // 0 - 15 char Clan; //…
-
0
votes2
answers103
viewsError giving python Mysql Insert
I have the table in my bank: create table tweets( ID_Tweet int not null auto_increment, ID_Candidato int not null, Conteudo_Tweet varchar(470) not null, constraint PK_tweets_ID primary key…
-
0
votes0
answers9
viewsZip file format
How to turn a file into a zip format for a table or a txt file? How to turn a file into a zip format for a table or a txt file?
-
0
votes2
answers230
viewsWhat is the size_hint_x attribute in Kivy for?
During my studies in the Kivy framework, I discovered two attributes of the object BoxLayout called size_hint_xand size_hint_y that by what they say, they fit the size of a widget to the size of the…
-
0
votes1
answer84
viewsHow to work with super accurate Python values?
I’m creating an algorithm and I’m encountering a strange problem, I have a set of precise values and an unknown goal, basically a neural network. I used several tactics to optimize weights and now…
-
0
votes1
answer98
viewsDjango n:n relationship with grid call
Good night. I am creating a system in Python/Django where I have a relationship n:n between a table Person and another Process and for this I created a third entity called Procedural part. I’ve done…
-
0
votes1
answer79
views -
0
votes0
answers20
viewsHow to make a web scraping on an aspx site using python
I’m trying to scrap a page that uses aspx. The point is that when I go to inspect element the data I need is there, but when I give the requests on the page comes everything from html, except the…
-
0
votes1
answer52
viewsThe URL responds only with the open site
I need to scrape the information from this page here. In the developer tools, I found this link with the necessary answers. The problem is that the link with the answers opens only if the site is…
-
0
votes1
answer118
viewsObject Orientation (SUPER HELP)
Here is a question that will require a more complete answer, will it happen? Note this script that simulates a person’s behavior. Class is Person and methods are the possible behaviors. Someone can…
-
0
votes1
answer82
viewsI want to put 2 exceptions for my program validate data
a = (''' Escolha a conversão que você deseja realizar: 1) Celcius-Fahrenheit 2) Fareheint-Celcius 3) Celcius-Kelvin 4) Kelvin-Celcius 5) Fahrenheit-Kelvin 6) Kelvin-Fahrenheit ''') try : a =…
-
0
votes1
answer973
viewsCould you create a function to decrease the number of if’s in the program?
There is a way to make a function that can reproduce that amount of if’s in the program so that they do not appear ? mensagem = (''' Escolha a conversão que você deseja : 1) Celcius-Fareheint 2)…
-
0
votes0
answers1085
viewsHow to plot or overlay graphs of a function with two variables using matplotlib?
I’m having trouble finding the right graph on my Plot, I’m modeling two physics equations of two variables, I believe the problem is because I’m not going through the graph correctly with my while,…
-
0
votes2
answers107
viewsSave manipulated audio files keeping the original name
I’m using an algorithm I found to perform noise cleaning of WAV files, but I need to run this algorithm in more than a thousand files and I need to keep the original name of the file that will be…
-
0
votes1
answer276
viewsTurn python script into database executable
I created a very simple python program to organize my work and tests, but I would like to make it portable to use on any computer. I know pyinstaller and cx_Freeze to turn the apps into executables,…