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
-
0
votes1
answer290
viewsPhoto gallery ordered in Python
Good morning I’m developing an image gallery listing them from a directory. What I have to do is separate these images or sort in order of creation. I have a script that generates the images as…
-
0
votes2
answers1557
viewsMaking a date set Random with pandas
I’m trying to extract 15O lines from a 500-line dataset. So I’d like to do it on Andom. My data objeto,cor,label cachorro,branco,animal manga,laranja,fruta calça,preta,roupa My script import pandas…
-
0
votes1
answer324
viewsHow to use Sleep for a Tkinter graphical interface loading effect
I’m willing to use the Sleep module team provides a load/wait effect on checking a condition. No use of Tkinter, the effect works perfectly, however, when I try to do the same with the Label of…
-
0
votes1
answer294
viewsHow to change the color of a curve when the values increase?
I have a data set. Sometimes some values increase compared to the previous ones. resultsCos = [(0, 0.4235497237569061), (0.005, 0.4235497237569061), (0.01, 0.4238950276243094), (0.015,…
-
0
votes1
answer44
viewsPython code in html is not working properly
I’m using Python and Django for a web application, at a certain point I make the following code in the html: {% for oportunidade in all_oportunidades %} <a>{{oportunidade.categoria}}</a>…
-
0
votes3
answers90
viewsProblem editing a list in Python 3
I do not understand what is happening with this excerpt of code. What was expected was that when imprint the list at the end he the elements of her split, but is returning the list as if nothing had…
-
0
votes1
answer70
viewsDjango + Postgresql Object has no attribute
I am trying to do a validation before submitting my form, but returns me the following error: 'Studentform' Object has no attribute 'termAccepted' models.py of the app: from django.db import models…
-
0
votes0
answers33
viewsRun several videos
I have about 8 sequences of videos that need to run as the user chooses the option (1 = Video_1, 2 = Video_2) Example: "Enter the desired option" "1 - Start Engine Machine 01" "2 - Reestablish…
-
0
votes1
answer37
viewsHeroku python file deployment failed
Good afternoon, I’m trying to deploy a python file 3.7.1 in Heroku but in the Heroku documentation states that it supports the version 3.7.2. Following error below: Error: Requested Runtime (Python…
-
0
votes0
answers47
viewsWhat is the name of the function before the loop for in Python?
Hello I come from the language c++ and java, and I am learning python. I came across the following piece of code: data = {'Player' : ['Wade', 'James', 'Kobe', 'Curry'], 'First' : [10, 10, 8, 12],…
-
0
votes1
answer901
viewsHow to delete a table row in sqlite3?
I’m trying to crud sqlite3 with a GUI through Tkinter my table was created in DB Browser for sqlite. I’ve developed a little but it’s not working: from tkinter import * from tkinter import ttk…
-
0
votes1
answer15
viewsProblems opening VLC and Running another def
Guys I’m creating a system that will talk and listen to the user, basically it runs a video and the guy has to answer (a quiz) QObject::~QObject: Timers cannot be stopped from another thread Follow…
python-3.xasked 5 years, 8 months ago Wallace Bruno 13 -
0
votes2
answers1609
viewsPython Mysql database connection
Trying to make the connection to my database, but is returning me the following error! Exception has occurred: Attributeerror 'Connection' Object has no attribute 'execute' Exception has occurred:…
-
0
votes1
answer406
viewsDjango Forms.Checkboxselectmultiple emits: Select a Valid Choice. [''] is not one of the available Choices
I’m trying to use a checkbox to select items in a list, but returns me the following error: Select a valid choice. [''] is not one of the available choices. py.models app: from django.db import…
-
0
votes2
answers408
viewsDjango + Python update and do not insert
I am using a filter to return some student and update their data, but when I try to save I get the following error: Student with this CPF already exists. and Student with this RA already exists. My…
-
0
votes1
answer43
viewsInsert with Where where I don’t have full value
Example, I already have in the table the following value in the column NUM_IMPRESSAO: K3244.K1019706.FSJC.08915 The new value I want to insert has only the last 4 digits (08915) and I need to insert…
-
0
votes1
answer55
viewsBest way to perform print command
I’ve been studying about Python for a short time and I’ve learned to display a print value in three ways: % '{}'.format(exemplo) f' {exemplo} ' There is one more way pythonic or each form is…
-
0
votes2
answers32
viewsDecryption error in request
I am sending the segiunte string via post (Javascript) to my server Bootle(Python): query = { 'wiki': `Tr%E1%BA%A7n_H%C6%B0ng_%C4%90%E1%BA%A1o`, 'uid':'f17afd66aae3a' } $.post(url, query,…
-
0
votes2
answers56
viewsCollect name of file used
I’m concluding a code that uses a lot of function copy of shutil. As I will distribute the file in executable format later and probably at some point will change its name, I want to know if there is…
python-3.xasked 5 years, 8 months ago RetroNietzsche 65 -
0
votes1
answer382
viewsHow to kill the process automatically with Popen?
I am running a parallel process in python: process = subprocess.Popen(['python',path, title, uid]) The program takes +- 1 minute to finish and runs normally. The process generates a PID that I can…
python-3.xasked 6 years, 1 month ago Vinicius Morais 1,293 -
0
votes2
answers201
viewsMatrix in python
I’m building a matrix in python, but I can’t make the right impression. Someone could help me. Follow the code: linhas = 4 entrada = input() valor = entrada.split() matriz = [] while (entrada !=…
-
0
votes1
answer466
viewsPyqt5 how can I make a button select a stacked Qt widget
I’m making a form in python, but I need to know what I do to make a button select the index of the stackedwidget as well as in c++ using Qt. from PyQt5 import QtCore, QtGui, QtWidgets import sys…
-
0
votes1
answer82
viewsHow to read the following code in python?
I found a code in Python, but I’m not getting how it works. from itertools import permutations n = 8 cols = range(n) contador = 0 for vec in permutations(cols): if n == len(set(vec[i]+i for i in…
-
0
votes1
answer3879
viewsHow do I determine a square matrix in python?
My file is like this: arq = open('matriz.txt', 'r') texto = [] matriz = [] texto = arq.readlines() for i in range(len(texto)): matriz.append(texto[i].split()) for i in range(len(texto)):…
-
0
votes1
answer231
viewsCompare string PANDAS Data Science
I’m starting in this world of data science and my doubt how I can compare two string in the same column. I have a column [Investigation Type] that has 'Accident' and 'Incident' I wanted to compare…
-
0
votes1
answer3684
viewsHow to calculate 'end time' in Python?
qpd = int(input('Quantidade produzida: ')) # qpd = Quantidade Produzida qpg = int(input('Quantidade programada: ')) # qpg = Quantidade Programada qrs = qpg - qpd # qrs = Quantidade Restante qpc =…
-
0
votes1
answer20
viewsError in removing the end of a list
esta dando erro no setProx(None) alguem pode ajudar ? def removeFinal(self): if self.isEmpty(): print("Impossivel Remover Lista Vazia") ultimoValorNo = self.ultimoNo.getElemento() if self.primeiroNo…
python-3.xasked 5 years, 7 months ago Harrison Mitchell 1 -
0
votes1
answer37
viewsopencv in python
I need to make an algorithm that reads the color code and opens a window with the color. I know I need to use the library cv, but I don’t know how you do it and I can’t find anything like it on the…
-
0
votes1
answer62
viewsI can’t do the "web scraping" properly from a Python comic strip site
Well, I was making a code that would check the day of each strip/gif of the page and, if the day is the same as the current day (in the code I put 14 only because the site does not update weekend…
-
0
votes1
answer44
viewsHow to create a list that has two mini lists inside it
How to create only one list that has two mini lists within it. And the size is idetermined, that is, as long as user wants to add values within this list (internal) it will add.
python-3.xasked 5 years, 7 months ago Wellington Felix 26 -
0
votes1
answer244
viewsPython error in Def _init_ function when creating a Chatbot
class wppbot: dir_path = os.getcwd() bot.def __init__(self, nome_bot): self.bot = ChatBot(nome_bot) self.bot.set_trainer(ListTrainer) self.chrome = self.dir_path+'\chromedriver.exe' self.options =…
-
0
votes1
answer30
viewsError executing Python3 script (with Symfony/Process) in an Laravel Controller
I’m trying to run a script in Python3 that I developed, which is located in a folder within the "Folder app" of Laravel. One script is called by a Controller and the other by an Artisan Command.…
-
0
votes1
answer97
viewsShow modal only if there is an active session
When someone registers their name and email I create a session and I rescan the page with the name of who signed up, but I’m not able to understand how I do so that the time I rescan the page…
-
0
votes0
answers22
viewsAlternatives to timesleep
Good night! Whenever I use delay or the time.Leep my code simply hangs until the end of the run, as far as I read they do not work in parallel Is there a lib that has the same hold function but…
-
0
votes1
answer5140
viewsUpdate version of Python
I have been researching since early but I can not solve this doubt: How to update Python via command prompt in Windows?
python-3.xasked 5 years, 7 months ago Fernando Barros 39 -
0
votes1
answer668
viewsIntegrate Rdstation with Django + Python p/ lead submission
Good morning guys, I have a problem: I have an LP that has to save the lead in the Postgres database and automatically send that lead to the RD platform using their API. using the curl I do it this…
-
0
votes1
answer769
viewsYou can return the id of the last data registered with Django Model Form
Guys, I have a question. I’m using Django and I wonder if you have how to return the id of the data registered with Modelform, example when you give a model.save() can recover the id of this guy who…
-
0
votes1
answer552
viewsWhat is the difference between request and request. Session()?
I would like to know the difference between request and request. Session() of the request module. What would be the ideal use of each?
-
0
votes0
answers148
viewsException has occurred: Variabledoesnotexist - Django
Hey, guys, I got a mistake I can’t figure out why. I am creating a simple web client registration app with Django, I am using vscode with text editor. When I start the application the error…
-
0
votes1
answer52
viewsPercentage of Video Game Genres in Spyder
I want to show the percentage of various genres in my code with the date set and it is giving a following error: Valueerror: Lengths must match to compare The part that has the error in my code is…
-
0
votes0
answers60
viewsButtons on a Gtk.Cellrenderer
I’m trying to make a program that saves some information in a comic, I can present the information in the window without any problem, but I wanted to add 2 buttons per line an "Edit" and another…
-
0
votes1
answer414
viewsHow Exploits are created?
I was researching server security, and I ran into the subject of exploits, I already understood the logic of a DDOS attack and an exploit buffer overflow, but I’m curious about one thing: How do…
-
0
votes1
answer101
viewsHow to get the Gmail source code using Python3
I am accessing the Email using this code I found and adapted: import requests from bs4 import BeautifulSoup form_data = {'Email': '[email protected]', 'Passwd': 'senhaexemplo'} post =…
-
0
votes1
answer363
viewsHow do I animate an object on canvas with a bind with an animation already "running"
I was making a copy game of Space Invaders but when I went to do the "shot" of the ship, I came across a following problem : As seen in Gif, when I press the key, everything on the canvas "freezes"…
-
0
votes1
answer114
viewsHow do I make pdfkit ignore extensions?
I have the following code import pdfkit options = { 'page-size': 'Letter', 'margin-top': '0.75in', 'margin-right': '0.75in', 'margin-bottom': '0.75in', 'margin-left': '0.75in', 'encoding': "UTF-8",…
-
0
votes1
answer79
viewsHelp me syntax my FOR repeat code
I want to return the percentages of video game genres, only this part of the code does not return all the results. porcent = pd.DataFrame(base.Genre.unique()) totalPorcGenre = len(base) for porcen…
-
0
votes1
answer51
viewsProblems when creating lists
I am trying to get the program to create a list with the name of the files found in the directory and within each entry of this list, create a list of strings with the contents found inside the…
-
0
votes1
answer1885
viewsTkinter 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
answers206
viewsSplit Double Python Array
I need to get coordenadas cartesianas and separate them so that you know what the ordered pair is. I receive a string where the dots come this way: x0,y0 x1,y1 ... xn,yn I used a array split by…
-
0
votes2
answers42
viewsIf a function is too long, is it recommended to divide it into smaller ones?
I have the following function, which I intend to extend: def get_dataframe(site, search): if site == 'pichau': try: soup = get_page(f'https://www.pchau.com.br/catalogsearch/result/?q={search}')…