Posts by Filipe Gonçalves • 236 points
29 posts
-
0
votes1
answer175
viewsA: Flask only updates after clear browsing history
Not quite the solution but it was enough to get around my problem, update the page with: SHIFT+F5.
-
1
votes1
answer175
viewsQ: Flask only updates after clear browsing history
I am developing a site for study purposes with flask, only I need to clear the browser history whenever I make any changes to my css, I am doing this because the browsers (Chrome, edge and Mozilla…
-
0
votes1
answer420
viewsQ: How to use pandas.read_sql_query within a class
I created a class to facilitate the use of the library psycopg2 responsible for connection to the Postgresql database. import psycopg2 as pg class Postsql: def __init__(self, Phst, Pusr, Ppwd,…
-
2
votes2
answers85
viewsQ: Performance testing, how to reduce running time
I want to create a function that returns a list with all the powers of 2 of the numbers from 0 to 99, in the shortest possible time. So far I have performed 3 tests and my current script is this:…
pythonasked Filipe Gonçalves 236 -
0
votes1
answer692
viewsQ: React-Native changing icon color alone
I’m implementing one of those "little eye" buttons that allows the user to view his password to check if it’s right, the button is already working as expected, the problem is that the button icon…
react-nativeasked Filipe Gonçalves 236 -
0
votes3
answers184
viewsA: Function to duplicate a Python list
The following solution works if the index is a fixed value and not a number from some function being executed within the list. lista = [['banana',0], ['caju',1], ['banana',2]] for fruta in lista:…
-
0
votes3
answers2034
viewsA: Handle cmd files using python
Welcome to Stackoverflow, you can write shell commands using python in a very simple way, as you have not specified exactly what you need I will give you a generic way to do this. import os…
-
2
votes1
answer892
viewsQ: How to create new routes dynamically python/flask
I am developing an application that makes predictions from models, and wanted to implement a feature that allows me to create new routes through a function. config =…
-
1
votes1
answer54
viewsA: Doubt about openCV training
There is no exact formula for calculating how much training a model needs to receive to fall into an "excessive training" or overfitting that despite being an English term is the most widespread…
-
0
votes1
answer33
viewsA: Bs4 returning only version
Try to use sopinha.find("meta", {"name":"generator"}), this should return you the full line in case you want to reduce the return further, try: sopinha.find("meta", {"name":"generator"})['content'].…
pythonanswered Filipe Gonçalves 236 -
0
votes1
answer799
viewsA: Doubt Filling a Combo-Box with Selenium and Python
Pedro to use xpath you need to inform the position where it is on the page for example here: elem = driver.find_element_by_xpath("html/body/div/div/div/fildset/div/div/div/select").click(); would…
-
2
votes1
answer639
viewsA: The Pytesseract does not recognize only one letter
text = pytesseract.image_to_string(img_new, lang='eng', config='--psm 10') Credits for the answer : https://stackoverflow.com/questions/54119597/pytesseract-does-not-recognize-when-its-just-a-letter…
-
0
votes4
answers87
viewsA: Comparing dictionary values() with list values
Well got a little confused even more because the return I got is an empty list but come on: You have a list called: lista = [21, 20, 23, 8, 10, 18, 19, 2, 12, 14, 4, 9, 22, 16, 5] and another list…
-
0
votes1
answer142
viewsA: json.loads Jsondecodeerror
From what I understand you’re trying to pass cookies to the right json.loads? I don’t know if this solves the problem but first: loads won’t work because the cookie you quoted at the beginning of…
-
0
votes0
answers68
viewsQ: Correct way to use Try except
I am working for the first time with an API and need to return an error if it occurs, follow my code with the clearest and simplest way I found to notify errors: if request.method == 'POST': try:…
-
0
votes1
answer183
viewsQ: Kivy Filechooser how to select a directory
I need to create an interface where the user can select a directory, my code: class MainScreen(FloatLayout): def __init__(self, **kwargs): super(MainScreen, self).__init__(**kwargs) b1 =…
-
0
votes1
answer491
viewsA: How to add an image to Kivy Python
I found the mistake, Was importing: from kivy.core.image import Image When it should really matter: from kivy.uix.image import Image…
-
0
votes1
answer491
viewsQ: How to add an image to Kivy Python
I need to add an image to my screen and was following what I was doing in all other widgets. My code: class MainApp(App): def build(self): layout1 = FloatLayout() button = Button(text='iniciar',…
-
0
votes1
answer169
viewsQ: Take the probability of belonging to each class
I have a theoretical problem where a store owner wants to know the chance of a particular phrase generating a sale, I have in hand a dictionary with 20 random words and 10 phrases formed by exactly…
-
0
votes1
answer1885
viewsQ: Tkinter how to change color of text
How do I change the color of a label to make the background black and the letters white ? I researched and what I found was the option to change the background to black however beyond the label…
-
0
votes2
answers60
viewsQ: How to create variables dynamically (Speech_recognition)
I need to transcribe a 21 minute audio using speech_recognition and recognize_google the problem is that the api does not allow any audio size, I do not know exactly which but it is greater than 30…
-
1
votes1
answer148
viewsA: How to share a dictionary between scripts
I solved the problem by creating a new script called jsonmanager.py: import json import os center_dict = {} def loaddata(): with os.scandir('Jsons/') as it: for entry in it: if entry.is_file() and…
-
0
votes1
answer148
viewsQ: How to share a dictionary between scripts
I have a central dictionary that gets all jsons files from my working directory: def loaddata(): with os.scandir('Jsons/') as it: for entry in it: if entry.is_file() and…
-
-2
votes1
answer993
viewsQ: How to terminate a script with Python threads
I am working with a project and need the user to have the option to terminate it at any time, the cleanest way to do this I have found so far was by the process manager terminating the python…
-
0
votes2
answers143
viewsA: Find arrays with the shortest distance
I can’t type a code in here the way I’d like but I think I can help you. You create an empty list and a while loop based on a counter that will receive the amount of distances you want to return,…
-
0
votes2
answers444
viewsA: Virtual Assistant
I’m working on something similar right now, however I couldn’t streamline my application using speech_recognition from python, as an alternative found some other libraries/programs that can help you…
-
1
votes2
answers1298
viewsQ: How to create a dictionary through a string
Good afternoon, I wonder if it is possible to create a dictionary through a string, for example: I create a loop for inside a list and this loop will always give me a name: lista = ['ameixa',…
pythonasked Filipe Gonçalves 236 -
1
votes1
answer89
viewsQ: Tkinter Python stopping the script
Good afternoon, I would like to create a window with the words "Application running" and tried the following: from Tkinter import * root = Tk() T = Text(root, height=2, width=30) T.pack()…
-
3
votes2
answers1851
viewsQ: How to assign a function to a button in Django Python
I am doing a Jango course and I would like to know if it is possible to assign a function to a button. For example: <form> <label for="word">Digite uma palavra:</label> <input…