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
-
2
votes1
answer482
viewsHow to take the class name inside a python method
I am creating a base class that keeps some common methods for daughter classes in Python3: import abc class Bot(abc.ABC): def log(self, message): bot = self.__name__ version =…
python-3.xasked 4 years, 7 months ago LeandroLuk 4,989 -
2
votes1
answer1301
views'Model' Object is not iterable
As soon as I click on a button that calls my view to edit the Row of the table in question shows me the error: 'Meumodel' Object is not iterable. I’m using Django 2.1.15 Python 3.8.1 SQL server…
-
2
votes1
answer423
viewsError: not all Arguments converted During string formatting
I’m taking the Python 3 course on video and I’m in exercise n° 82. Even though my code and the teacher’s code are almost identical, mine is making the mistake not all Arguments converted During…
-
2
votes1
answer141
viewsPerform data counting based on grouping 2 or more columns in a Pandas.Dataframe
I want to find in this Dataframe, the 3 best user_id for Nome prova. That is, those who have the highest number of values 1 in the correct column ( such column is composed of values 0 and 1 ): Nome…
-
2
votes1
answer6781
viewsCenter text in python
Good afternoon, I’m creating a program to generate certificates, but I’m having trouble centralizing the names, how could I do that? For every name is of a size. I tried the center(), but it didn’t…
-
2
votes2
answers46
viewsPrint an attribute of several classes
I am creating a program that will launch the establishment products and creating each product being an object already that they have type, name and price. I want to print a specific attribute of…
-
2
votes1
answer69
viewsObjective of str()
I’d like to know what role the function plays str() on line 33(code does not work without this function, gives this error: Typeerror: Unsupported format string passed to list.format) jogadores =…
-
2
votes1
answer44
viewsModifying privileges with python
I am facing the following problem, I am increasing the privileges with "Elevated", but after running the.mkdir (), I would like him to lose his privileges and return to being an ordinary user.…
-
2
votes2
answers2053
viewsEoferror: EOF when Ading a line
I’m doing a program that’s a resolution of this issue of the Computer Olympiad. A, B, C = input("A").split(), input("B").split(), input("C").split() A, B, C = int(A[0]), int(B[0]), int(C[0]) if A…
-
2
votes1
answer76
viewsSum of Values within Compound Lists
I have a question about how to add certain values in Composite Lists. And I wanted to know that there is a quick method for this very. lista_total = [] d = 0 while True: nome = str(input('Nome: '))…
-
2
votes2
answers283
viewsjwt.Decode - what is the need for a list of algorithms?
I am studying Python and needed to solve an exercise using JWT (JSON Web Tokens). It was necessary to create a token and verify the validity, searching for example codes, found in the documentation…
-
2
votes2
answers397
viewsLONG delay in requests.get Python
I’m having a problem that when I perform requests.get diverse sometimes python starts to take A LONG time to get the request. I already thought it may be the API itself refusing my access, because…
-
2
votes1
answer95
viewsConsulting previous index in Python
That question is a continuation of this here As previously reported, I have a script that does a txt search for a keyword (APPLE) and if it is true, it alters another part ("00" or "01" or "02") of…
-
2
votes3
answers1578
viewsSeparating numbers into even and odd lists - Python
My code needs to read multiple numbers and put them in a list, then create two extra lists containing only even and odd values respectively from the previous list. Example: Entrada = [3, 7, 8, 11,…
-
2
votes1
answer54
viewsReceive 12 elements and separate them into 3 lists
I need to receive three lists generated in the shell to process in Python: l1=4 3 2 1 l2=2 1 3 4 l3=1 2 3 4 In the shell script step this way: python3 orth_median.py ${o_l1[*]} ${o_l2[*]} ${o_l3[*]}…
-
2
votes1
answer83
viewsRemove Repeated Elements from a List[0] from the List Database[1]
I have a list structure inside the list (list=[[ ],[ ]]). Example: lista = [['pedro', 'marcos', 'mario', 'pedro', 'marcos', 'mario'],[5.2, 2.2, 6.1, 6.2, 1.1, 5.0]] I am trying to remove the…
-
2
votes1
answer88
viewsHow to access a function within a python dictionary?
We have the following functions: def oi(): print('oi') def ola(): print('ola') Now let’s store them inside a dictionary as follows: saudacoes = { 'chegada':{ 'simples': oi(), 'cult': ola(), } } I…
-
2
votes1
answer67
viewsHow to select multiple items from a dropdown, choose these items with a button, and then reload the screen?
In this html code of a Django project how to add a feature that the user will choose how many services they want and click on the button when finished choosing. In this application I can only choose…
-
2
votes2
answers69
viewsI can’t debug imported module in project in Visual Studio Community 2019
I’m using version 16.7.5 of Visual Studio Community 2019 where I’m implementing for the first time a pyproj (Python version 3.8.3) in a virtual environment env. I installed the library…
-
2
votes1
answer181
viewsLinear Regression Evaluation and Graph Problem
My problem is that I can’t plot a line - first-degree function graph - in my first linear regression model. As a result, I have lines joining the scatter plot points of the training Features. I…
-
2
votes2
answers110
viewsCompare files in folder and delete specific ones in Python
I am very beginner and I have a doubt in a situation that I am creating, if anyone can help me thank you. I am trying to develop a program in Python that solves my daily stress of deleting some…
python-3.xasked 4 years ago Veloso 23 -
2
votes1
answer281
viewsHow to sort a list in Python
I’m solving a Python exercise that asks me to sort a list of 5 values typed by the user in ascending order, without using the Sort() method. The problem is my code isn’t working as it should. The…
-
2
votes2
answers97
viewsHow to access a list that is inside another list in Python?
I have a list that has within it another list with the students' names, and a list that has been divided into two more lists, representing the first note and the second note. For example:…
-
2
votes1
answer467
viewsTurn row into column
Good night, I’m having a problem of putting together more than 500 csv files, where I need a very important data that is in a row (A8), but it needs to turn column (like this in the second image),…
-
2
votes2
answers52
viewsI can’t write a specific number count inside a list
Hello, good afternoon everyone. I am a student in Python language and I am having difficulties in an exercise. I developed the code that returns me a list with my numbers entered in the list, but I…
python-3.xasked 3 years, 11 months ago Jean Flordemiro 37 -
2
votes0
answers46
viewsSelenium.common.exceptions.Nosuchelementexception: Message: Unable to locate element: //div[@class='classificacao_run points']//table
Hello, I made a python webscraping on mozzarella and it worked. However, when I tried to apply the code on another site, I’m getting the title error message. In practice: When running the program…
-
2
votes1
answer1653
viewsdoubts of logic in Python
I am a beginner in the world of programming and also in python. Solving some exercises I came across this Make a Program for a paint shop. The program should ask for the size in square meters of the…
-
2
votes2
answers116
viewsOptimization through dataframe (Pandas)
I need to compare two. csv files for inconsistencies. The boleto.txt file contains information about the boletos issued by a company. This file has 500,000 lines. The.txt file contains information…
-
2
votes0
answers31
viewsPlotly tree graph showing wrong python values
That boy-girl Sunburst plotly, when used in a dataframe of this spreadsheet, through the code below, generates a graph wrong values of the 'rest' column. For example, in the path…
-
2
votes1
answer302
viewsCheck that the string only contains Python letter and space
I want the user to enter their full name, but if they put something other than letters, it should display an alert message. The problem is that the user’s full name requires space between words, and…
-
2
votes3
answers112
viewsIn Python how to pass the self between 2 windows using modules
I’m learning Python, version 3.7 with Pyqt5 (Qt Designer) I’m trying to define the value of a label using modules, in window 1 it calls the function and works, but when I open window 2 and click on…
-
2
votes0
answers52
viewsWhy is "c_float()" generating incorrect values?
I am creating a program in Python - using the library ctypes - to read and write values in memory, and I want to be accurate in the size of the data to be read and written. In this case, if the…
-
2
votes4
answers350
viewsHow to add values from a dictionary with arrays by the Python key?
I have the following dictionary: { 'tvmv': [121, 250, 48, 45, 54, 120, 115, 138, 60, 30, 274], 'avic': [358, 60, 40], 'hotels_resorts': [60, 31, 45, 50, 300, 165, 40, 46], 'avani': [70, 40],…
-
2
votes0
answers33
viewsModulenotfounderror trying to use Behave, Selenium and Python
Rewriting the code from a previous exercise, this time using Behave. Problem is I can’t even begin because I can’t import with the necessary functions. My directories are these: -Curso_de_Selenium…
-
2
votes4
answers177
viewsInsert names to a list depending on their value
I’m trying to make a draw code, the user inserts the value to be donated and your name. Let’s assume that Bia donates 10 real, Bia’s name has to appear 1 time on the list. And let’s assume that…
-
2
votes1
answer22
viewsPylint on Vscode
I’m starting to use the VSCode to work with Python, and would like to set up the Pylint to highlight|warnings errors while typing (such as PyCharm makes), by default lints are only 'executed' in…
-
2
votes1
answer58
viewsWhat is the difference between utils::Urlencode() output in R and urllib.parse.quote() in Python
I wanted to understand the difference between utils::URLencode() in the R and the urllib.parse.quote() in Python, for example: In R: tster <-…
-
1
votes2
answers1175
viewsPython Numpy library
Like installing a library in python, using Windows 7. I try to download the Numpy and appears at the prompt: libraries f77blas,cblas,atlas not found in C:\Python33\lib libraries lapack_atlas not…
-
1
votes1
answer66
viewsIs it possible to know what shapes are currently available?
I’m using the module turtle of Python and would like to know if there is a way to know what the types of Shape that the turtle can assume. I know that one can create or add more shapes to the…
python-3.xasked 10 years, 1 month ago user14079 -
1
votes1
answer926
viewsSave text from a Tkinter Text object in a variable
I wonder if there’s a way to save the textual content of an object tkinter.Text in a string variable. Why? Because I believe the Tkinter.Text object is inside a function, and therefore it is not…
-
1
votes1
answer161
viewsAdd shortcut to a Tkinter menu
I wonder how to add a shortcut menu item. I’ve been searching and seen it can be done using a special function common to all widgets in the module tkinker, that is to say the function bind. What I…
-
1
votes2
answers102
viewsIs it possible to loop with a variable jump?
I wonder if it is possible to create a loop with variable jump. For example, in the cycles shoot the jump would be 2 and in even cycles the cycles would be 4. I tried to do it with Python’s ternary…
python-3.xasked 10 years ago user14079 -
1
votes1
answer3762
viewsClear the IDLE contents with a command
I’m creating a database which generates tables, but for the graphical part I’m not using any particular bookstore, like Tkinter, but only IDLE and some prompts. But I would like to improve the menu…
-
1
votes1
answer47
viewsDisplay contents of a list recursively
We’re studying recursion in our programming course, and we have an exercise where we have to show in Idle the contents of a list using recursiveness. I did so: def print_list_r(ls=[], n=0): if…
-
1
votes2
answers118
viewsHow to improve this "Flattening" function from a list
At school we are studying recursion, but of course this is never obvious. We have to create a function that "Flatten" the list. I’ve seen something on the net, and I’ve solved mine in this way:…
-
1
votes2
answers515
viewsHow to create a recursive algorithm to find the depth of a list
I’m trying to create a recursive algorithm to find the depth of a list, which is the largest number of nested lists, But this is complicated, I can’t find it. I understand the path that the…
-
1
votes1
answer835
viewsError in reading JSON
I am trying to read the Jsons from a folder and get the proper values, I have tested all the Jsons to see if they were valid. The folder with the Jsons is called 'test' for dirname, dirnames,…
-
1
votes2
answers584
viewsIs it possible to create a communication between a Tkinter application and a pygame?
I know that tkinter is not thread-safe, but honestly I’m not quite sure what that means yet. We’re creating a game with pygame, and would like to integrate a menu initial and a console written with…
-
1
votes0
answers345
viewsCould not parse the remainder: '[1]' from 'i[1]' in Django
I am trying to make a check to modify the bootstrap component according to the status id, but it returns me this error: Could not parse the remainder: '[1]' from 'i[1]' in Django The code snippet…
-
1
votes2
answers2951
viewsCopy file content to clipboard on Windows
Hello, I am making a software for a forum, where members consult the patterns of posts by the software, I am storing these patterns in files and asking Python to read these files and display them,…