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
-
1
votes1
answer545
viewsSocket in python
I’m doing the discipline of networks and computers and I’m having trouble on the following question: Using TCP, deploy a server that offers two features: uppercase and Daytime. The client, when…
-
1
votes2
answers3082
viewsPython data entry with multiple lines
I would like to understand how to input several data (int, float, str...) per line but repeatedly (i.e., in several lines) so that I can save each given input. I understand that I will have to use a…
-
1
votes2
answers178
viewsFormat output in txt file
I have the following code: def verificaPrimo(num): if int(num) < 2: return False else: for n in range(2, int(num)): if int(num) % int(n) == 0: return False return True def…
-
1
votes1
answer41
viewsFormat Python Query
I want to adjust my Python query so that I can correctly generate a chart in Chart.js. I have the following code for query and generation of json file def get(self, request, format=None):…
-
1
votes0
answers332
viewsPandas: How can I update values in dataframe?
I have two spreadsheets where one is updating the other. How can I update this data using pandas? Example, where 'b' updates 'a': a = {'campo': ['a', 'b', 'c'], 'valor': ["", None, 1]} b = {'campo':…
-
1
votes2
answers1391
viewsConcatenate two Dataframes
I need to generate a new dataframe with the concatenation of two dataframes. The following code works, but it takes a long time to run. df_concatena = pd.DataFrame() for x in range(len(df)): for y…
-
1
votes1
answer83
viewsNumerical comparator
print ("Insira dois valores para serem comparados:") Valor1= float(input("Escreva um número:")) Valor2= float(input("Escreva outro número:")) print ("Os números que você inseriu foram esses?","\n",…
-
1
votes2
answers765
viewsRead file in previous python folder
so I’m wanting to save a python file in a folder previous to the one running the script ex:my script is in the /app/controllers/script.py directory i want to put the file I will create in the…
-
1
votes1
answer44
viewsPanda does not create new lines in Spreadsheet
When creating the program in Python I take some information and put it inside a list. When trying to write this list in an excel file the data ends up getting all in the same block without creating…
-
1
votes1
answer131
viewsHow to write a python module from a test?
I’m doing an inverse exercise on Python modules and tests with pytest, but I’m not succeeding. Whenever I run the code I get the message "E Attributeerror: 'str' Object has no attribute…
-
1
votes1
answer247
viewsPassing arguments to python . exe with cx_Freeze
I have this code to test the script passage ola py. import sys for arg in sys.argv: print (arg) print ("Hello World!") setup py. from cx_Freeze import setup, Executable setup( name='Ola',…
-
1
votes1
answer784
viewshow to improve the time in Python 3 voice recognition?
I’m trying to make a program that listens to what I say and responds to what I say, I have a code here more or less that I created, with the pygame. To specify when I run the code in the pycharm it…
python-3.xasked 5 years ago Ruan Ferreira 11 -
1
votes1
answer92
viewsnpyscreen with accessibility
I am helping a colleague who is blind to programming in Python! It uses the notepad and a screen reader called nvda (python). We are having difficulty with the registration form because the nvda is…
python-3.xasked 4 years, 11 months ago Éder Garcia 785 -
1
votes1
answer282
viewsGenerate XML file of more than 1 Mi of records with Xml.etree.elementtree in python
Please, how can I generate an XML file, with Xml.etree.elementtree in python, but in such a way that it creates the file of 5 thousand in 5 thousand resgitros, without the need to wait to load the…
-
1
votes1
answer171
viewsPython Hashlib Function: Typeerror: update() takes in keyword Arguments
I am working on a script where in one of the steps I will have to use the function hashlib to convert one string list to another via SHA256. However, I’m having some problems that I haven’t been…
-
1
votes3
answers1495
viewsMerge elements from a list with the last different tab
An exercise in a book I’m studying has the following question: Suppose you have a list value like: spam = ['apples,'bananas','tofu','cats] Create a function that accepts a list value as argument and…
-
1
votes0
answers58
viewsHow to dynamically define the function to be called in Python
Hello, I would like the program user to write a function for later use, however I’m having difficulty to implement this: See the example below: def funcao_integracao(x): y=x**2 return y def…
-
1
votes1
answer204
viewserror in a real-to-dollar python converter exercise
Hello, I’m trying to make a converter from real to dollar and to normal values it works but is giving error when I put the dollar*N10, type 420 real, or 840, it is left the exact value of the…
-
1
votes0
answers63
viewsConnecting modules and packages
I am trying to implement a GUI with python3x and Tkinter in separate scripts. I have a gui_test folder organized as follows: Gui (sub-folder): Unit.py and app.py (Tkinter) utils (sub-folder):…
-
1
votes0
answers193
viewsAnti-captcha- Error "Captcha Wrong"
I find myself with the following problem: By submitting a form, after solving a captcha, the following error is returned: Captcha Errado I’m wearing the following API Code Used: check_key =…
-
1
votes3
answers415
viewsInterfacing of vectors in python
Make a program that fills two vectors of five numerical elements each and shows the vector resulting from their intercalation. Vectors must be initialized with the values below:…
python-3.xasked 4 years, 11 months ago Pablo Leonardo 69 -
1
votes2
answers50
viewsError in python3 function
I made this function where will be assigned a name and a value, which enter a while loop repeating 5 times, each time the loop repeats the values will be assigned to a different list, finally it…
-
1
votes2
answers179
viewsEncoding problem while extracting zip file - edited
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 GET at the file url. I need to extract this few files…
-
1
votes2
answers53
viewssaving Dict list on file
I have a function that saves a Dict in a file, but this is simultaneous, I mean, every time I have a new Dict. I couldn’t apply the concept of append to this problem. The Archive is being saved this…
-
1
votes2
answers149
viewsHow to extract only words from any text, ignoring punctuation and uppercase letters?
Be the text below: This is the most favourable period for travelling in Russia. They fly quickly over the snow in their sledges; the motion is pleasant, and, in my opinion, far more agreeable than…
-
1
votes0
answers36
viewsList indexes
Good afternoon, this week my teacher passed me the question of scheduling a phone book. I did with dictionary but he had me redo with lists. There’s a part where I have to remove a contact from the…
-
1
votes1
answer111
viewsProgram to check number of words and a sentence of a text file
text file used: https://easyupload.io/j5agtq The method is part of a class called Arqtext Objective: The method does not use input and returns, in a tuple object, (1) the average number of words per…
-
1
votes1
answer106
viewsTypeerror: can’t pickle _thread. _local Objects when I try to use scikit-Learn RFE in a template created in tensorflow
I’m trying to use the scikit-Learn library RFE on models I created using tensorflow, but when I try to train I get TypeError: can't pickle _thread._local objects. Follow the code and error below:…
-
1
votes2
answers230
viewsWorking with querysets and Celery
Following what I had asked here, I keep trying to run my code asynchronously. I’m trying to use Celery to perform this procedure, but I’m having some problems. I had the following: def get(self,…
-
1
votes1
answer114
viewsHow to pass a function as an argument in Python?
I tried it in various ways, using local variables and assigning them the two methods but it didn’t work, does anyone know where I went wrong? def game(init, loop, frame_rate=60): from time import…
-
1
votes1
answer1279
viewsReferencing Variables in Python Imported Functions
I am learning Python on my own and in many videos and subjects programmers advise and emphasize the importance of "clean and organized codes". So I’m trying to create classes and functions in…
-
1
votes0
answers38
viewsHow does Pickle behave with stored variables? (Python)
I’m learning Python on my own and now I’m practicing the Pickle module. I managed to make it work normally, but it occurred to me a question about what happens when I store a variable in the pickle…
-
1
votes1
answer197
viewsI have a neural net, and now?
Hello, I made a neural net watching a video class on, the code is very simple but functional. And open a csv file, sort the data and do the training, right after the test is done and the result is…
-
1
votes1
answer141
viewsControlling the Plot range of matplotlib , use problem of 100% of ram memory
Hello community of Stackoverflow :) I am developing a small code that will plot you from 2 filled lists from an equation while a while condition is not satisfied. Once the lists are filled in, I use…
-
1
votes1
answer73
viewsDisplaying the tags of a web page with indentation proportional to the depth of the element in the document tree structure
Issue: Develop the Myhtmlparser class as an Htmlparser subclass which, when fed with an HTML file, displays the names of the start and end tags in the order they appear in the document, and with a…
-
1
votes1
answer320
viewsHow do Tkinter wait for user interaction during the script?
I am learning Python on my own and now I took it to learn GUI in Tkinter. If anyone can help me, I’m having trouble getting the program to display a greeting and then offer options on different…
-
1
votes0
answers851
viewsPocketsphinx voice recognition - Python 3.5
I am doing voice recognition with the modules pocketsphinx and Speech recognition, but when I went to make the code available offline, the program returns the following error: Traceback (most recent…
-
1
votes1
answer637
viewsHow to access data in json and save to a variable in python? flask-api
I am making a very simple Flask Api, I will receive a title and a body in json.. { "title":"Test", "body":"test" } My app.py class is like this from flask import Flask, request, jsonify, json app =…
-
1
votes1
answer307
viewsReturn in python 3
I am creating a function in python3 and a question arose about the use of Return, when we call him in the code he must terminate the function immediately? In the code below this is not working, even…
-
1
votes1
answer445
viewsAccess properties of a Python file
I want to access the properties of a file using Python. I saw that it is possible to do this using the function listxattr of the OS module, but when trying to use it, it gives me an error. See my…
-
1
votes1
answer384
viewsReturn pixel of a certain color analyzed by Imagegrab
I need to identify a color in a pixel "rectangle" and return its position to save to a variable. For example, in this image, I need to detect the blue color, and when detected it returns to me the…
-
1
votes3
answers127
viewsCode does not work as expected
My code should read name and weight using an auxiliary list and throwing the data to a main list. In the end, it generates a result of the highest and lowest weight with the name of the people who…
-
1
votes1
answer117
viewsHow to connect a python container Docker to a sqlserver
I want to create a python3 container that can connect to a SQLSERVER, I’m using Django in my application and it doesn’t have a native driver to make that connection. I created an image to configure…
-
1
votes3
answers132
viewsMerge 2 Programs - Python (3)
I created 2 programs separately to convert Real to Dollars and another to convert Dollars into Real, what I would like to do is create a kind of menu or input, where it would be written: "Type 1 to…
-
1
votes1
answer108
viewsFor nested only works in first iteration (Python)
I’m trying to get one nested to compare lines in two different csv files, but after the first interaction of the first file is searched inside the second file and skip to the second iteration, the…
-
1
votes1
answer2453
viewsPython - how to create spreadsheet in excel (with 100 columns)
Good afternoon! I already know how to create a spreadsheet in Excel by Python, when I know exactly which columns I need to create. But how can I make the creation of columns dynamic? for example: to…
-
1
votes1
answer442
viewsAdding a column of numbers 1 to a numpy array
Let X be the numpy array below: array([ 6.1101, 5.5277, 8.5186, 7.0032, 5.8598, 8.3829, 7.4764, 8.5781, 6.4862, 5.0546, 5.7107, 14.164 , 5.734 , 8.4084, 5.6407, 5.3794, 6.3654, 5.1301, 6.4296,…
-
1
votes1
answer158
viewsWhy use double clasps in Pandas?
Given the following Dataframes: df = pd.DataFrame([[1, 2, 1], [4, 5, 2], [1, 2 , 3]], columns=['coluna1', 'coluna2','id']) df2 = pd.DataFrame([[1, 7, 1], [4, 'a', 2], [1, 'abc', 3]],…
-
1
votes2
answers113
viewsEncapsulation of functions
Below is an example of using a function passed as a parameter to another function: def gera_nums(): lista = [] for c in range(0, randint(1, 15)): lista.append(randint(0, 100)) return lista def…
-
1
votes1
answer139
viewsTurning binary into a Python chart
Good evening I have a message that I turned into binary and wanted to make a graph from the following patterns ami pseudoternary, where if the binary digit 1 the frequency is 0 and if the binary…