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
answer1654
viewsHow to concatenate strings into a list?
If I have a list of string-like objects and want to concatenate all these items, how do I do that? For example: row1 = ['___', '___', '___'] I would like to print: '___|___|___' I managed to do so,…
-
1
votes2
answers77
viewsHow to "reimport" an object from a Python module?
I wrote a module called mymodule.py who has the function def funcion(x): return x So I imported this function into a code like from mymodule import function and worked normally. Then I wanted to…
-
1
votes0
answers22
viewsHow to import another model from another module in Odoo?
In an Odoo module, there is a section on __manifest__.py, where it indicates which are the dependencies. __manifest__.py ... 'depends': ['base', 'mrp'], ... With I access the resources of mrp from…
python-3.xasked 5 years, 11 months ago rogeriojlle 187 -
1
votes0
answers120
viewsDefine sections in a color recognition program
I am working on a project, which next year will become my TCC. I am learning the language of Python, and for now I have had some advances. I was reading about computer vision, but I still have some…
-
1
votes3
answers665
viewsHow to turn content from a file into a dictionary in Python?
Guys, I have a file and I’m taking the contents of it and adding it into a variable. The contents of the file and the value of the variable is like this: NAME=Maquina01 ID="MAQ 15478" version=08 I’d…
-
1
votes2
answers406
viewsPython calling super() in class that does not implement inheritance
I’m developing some middleware and as I delved into Django’s source code I came across the following: class MiddlewareMixin: def __init__(self, get_response=None): self.get_response = get_response…
-
1
votes1
answer562
viewsHow to delete a specific print line in cmd Python
Lately I have appeared an error using lib progressbar2 to create a bar in windows 10. When I put it in full screen or decrease the size it starts to create bars: Error I solved the error by cleaning…
python-3.xasked 6 years, 2 months ago Mateus Oliveira 11 -
1
votes1
answer47
viewsModels in Django is everything in one file?
I’m starting my studies in Django, I come from frameworks like Rails, Laravel, Asp.Net, and I came across a difference that I was surprised that in Django the models are all together, is that…
-
1
votes1
answer4261
viewsLimit Python number input 3
Using the following code I want to limit from 0 to 2000 the number that can be informed by the variable in a import collections num = int(input('Digite um número inteiro: ')) #Inputar número inteiro…
-
1
votes0
answers1062
viewsError: "sqlite3.Operationalerror: no such table"
I’m making the following mistake: sqlite3.Operationalerror: no such table: product I already checked in my database, the product table is there Code: from tkinter import * from tkinter import ttk…
-
1
votes1
answer78
viewsUse await with object that implements the __await__method
From the Python 3.5 was introduced async/await I am implementing some objects long-awaited but I am met with doubts follows an example: #!usr/bin/python3 # -*- coding: utf-8 -*- import asyncio class…
-
1
votes0
answers680
viewsHow to subtract two large vectors?
I want to calculate the vector difference between two large vectors. I am able to subtract a list of matrices for a matrix and put it to the power of 2 (train["quest_emb"][0] -…
-
1
votes1
answer103
viewsProblem in python print
I have 2 inputs that receive the first and last name of a person, then is informed the values typed and is asked the age of the same, but the print is showing the name information between "Square…
-
1
votes0
answers720
viewsHow do I check a login with sqlite3 + Python3?
from tkinter import * from tkinter import messagebox from random import randint import os import sqlite3 from tkinter import ttk con = sqlite3.connect('BancoDeDadosCadastro.db') cur = con.cursor()…
-
1
votes1
answer121
viewsProblem passing argument via Python command line
I am a beginner in Python and am facing the following problem to pass an argument via Python command line. from math import pi import sys def circulo(r): return pi * float(r) ** 2 if __name__ ==…
-
1
votes3
answers1193
viewsPython 3 number rounding
I am developing a project to calculate the wear of certain parts of a vehicle. However, I am still new to the Python language. My problem, for example, is this:: The liter of fuel costs R $ 5,83,…
python-3.xasked 5 years, 9 months ago Silvano Junior 41 -
1
votes1
answer37
viewsDefinitions and their use in classes
When I create a "def" from what I understand is different from __init__ right? If I create an object in the __init__ it is possible to access it from other def's? In some codes I noticed they use…
-
1
votes1
answer263
viewsWhy doesn’t this python code work?
list = [ 1, 2, 3, [7, 8, 10, [1, 2, 3, 5]], 1, [2, 3, 9]] for a in list: print(type(a)) if type(a) == list: print('E lista') I don’t understand why it doesn’t work, can someone explain to me?…
python-3.xasked 5 years, 9 months ago Pedro H. 29 -
1
votes0
answers30
viewsQuick read script on python3?
Does anyone know any script for python3, which makes me paste any text into the program, and it reads from line to line at a certain speed, example Approx.WPM:5000 (5000 words per minute)? I’d…
python-3.xasked 5 years, 8 months ago Antrukz00 11 -
1
votes1
answer92
viewsList as function input
In Python 3.7 items of a list can be arguments of a function? def media(x,y,z): lista = [7,8,9]
-
1
votes2
answers1709
viewsModulenotfounderror: No module named 'wordcloud'
I’m using the Microsoft Azure with Jupyter notebook and I need to use the word cloud. However when executing the code: from wordcloud import WordCloud it presents the error No module named…
-
1
votes4
answers1706
viewsFunctions of PYAUTOGUI not working
I am automating the installation of software using python with pyautogui: import pyautogui import time import pyperclip for window in pyautogui.getWindows(): pyautogui.getWindow(window).minimize()…
-
1
votes1
answer61
viewsHow to make a Sorted by a specific csv column?
I have a file. csv and need to make a Sorted by a specific column ('salary' column) and list by the column 'name' the top 10 salaries without using PANDAS. Can you help me? Thanks in advance.…
-
1
votes1
answer2796
viewsEdit word file . doc in Python
I am developing an application in Pythonand Django and need the user to attach a document file .doc. Done this, in this file, the user will have typed some variables, and I need to replace them with…
-
1
votes2
answers5265
viewsScientific notation in Python
I thought about making an electrostatic formula that would give the result in scientific notation, but I don’t know how to leave it in scientific notation. Is there a library for that? n =…
-
1
votes1
answer329
viewsHow do I make a button draw something new on a screen with Tkinter?
I tried to make a data simulator in Python with Tkinter that shows the data layout in the window after scrolling. For this, I defined a function that generates a random number from 1 to 6 and draws…
-
1
votes1
answer262
viewsHow can I get the color of a pixel using python3
I would like to know how I can, using python, get the color of a pixel from the web? I’m trying to make a bot and I need it to collect the color of the web page and not an image of the following…
-
1
votes2
answers824
viewsRead a csv file and add your data into a dictionary
I have a code where I will have a function that will pass the data from a csv file to a dictionary. The process will be to take the films with their respective notes and add to a dictionary relative…
-
1
votes1
answer23
viewsCoding problem A u015bvagho u1e63a (Python3)?
I’m working with wikipedia, and I’m having some coding problems. When I add such a link in my browser everything works fine: https://en.wikipedia.org/wiki/A%C5%9Bvagho%E1%B9%A3a That goes in the…
-
1
votes2
answers2874
viewsPython, Caesar Cipher, Strings
Hello, I would like to ask for some tips to improve the code, especially in the function 'geraMsgTraduzida', to make the code more beautiful if possible. def recebeModo(): """ Função que pergunta se…
-
1
votes3
answers497
viewsConvert string into a list where each element in the list is 3 characters from my initial string
I wonder how I can turn one string on a list where each element of that list is a string with 3 characters from string original. Therefore if the string original was like this "AAGGGTTGG" I get a…
-
1
votes1
answer331
viewsHow to get a pixel color out of the screen limit in pygame?
I know to get a color of a pixel in Pygame I use get_at. But I have a huge background image and a lot of it is outside the screen area delimited by pygame. For example, a 1000x1000 image inside a…
-
1
votes1
answer200
viewsHow to create simple list from composite list?
What is wrong here? I would like the output to be [123, 456, 789]: a = [(1, 2, 3), (4, 5, 6), (7, 8, 9)] b = [] for num in a: x = '' for num2 in num: x.join(num2) b.append(x) print(b)…
-
1
votes1
answer92
viewsHow to create a condition "if all the elements of a list then inside a set list" (Python)?
I’m trying to say, "If all elements of a list are in a list of sets". a= [0,1,2,3,4] b=[ 3,4,5,6,7] c=[0,1,8,9,10] d=[0,1] e= set(a).intersection(b) f = set(a).intersection(c) g = [e,f] print (g) if…
-
1
votes1
answer267
viewsManage Gtk+ window swapping
Hail to you guys, I’m trying to make a program with Gtk+ (python3) to save some information in a comic book but I also want to identify users by login, (Quick explanation on how the program works).…
-
1
votes2
answers11645
viewsHow to create graphical interface in Python?
Guys, I know the basics of python and I was wondering if it’s possible to create a graphical interface for the programs I do on it. Something like that interface that you can do in VBA. Can I do…
-
1
votes2
answers123
viewsHow to make an associative matrix in python 3?
I have a code that asks for a matrix 8x8, but I need in the input He asks for the values like this: matriz [A][1]: matriz [A][2]: That is, he asks for the line in letter form and the column in…
-
1
votes0
answers47
viewsAbsurd performance difference between pygame.surfarray.array3d and array2d
Using the pygame.surfarray to control an image as an array, manipulating any element in an array3d is more than 5 times slower than manipulating an element array2d. See this benchmark: from datetime…
-
1
votes1
answer1396
viewsSort list with Python + Django
Good afternoon guys, I have a problem, register by the Django admin a video that should be sent to my template, however I need these videos to be ordered by the field position that I have in my…
-
1
votes0
answers59
viewsProblem with the python Random function
Hello I have a typeErro problem. but I don’t know what can be, I’m beginner in python import random def ataque(bonus, defesa, dano, bonus_dano): dano_total = [(random.randint(1, dano)+bonus_dano)…
python-3.xasked 5 years, 7 months ago bruno boff 23 -
1
votes1
answer188
viewsComplex operations with Python (pygame.math.Vector2)
I am learning Python and I came across a complex expression that derives from pygame.Vector2: import pygame x = pygame.math.Vector2(1,2) b = x * 5 - (1, 2) print(x) print(b) Upshot: [1, 2] [4, 8] In…
-
1
votes0
answers330
viewsError of Memory in Python
I’m tempted to days solve this problem and can’t, my scripts works on various python machines, but on the server I need to run the application and presents the error, I’ve left a memory test running…
-
1
votes1
answer216
viewsNotification system
I have the following model: from django.db import models from django.utils.timezone import now # Create your models here. class Event(models.Model): name = models.CharField('nombre',max_length =…
-
1
votes1
answer439
viewsFilters in TXT file
https://drive.google.com/open?id=1ud743B57XM_iZ_wvQrSYGRrMo-5nT94p I have a file txt that I have to apply a filter to bring me a field in column 2. And then save the result in csv, so it’s easier to…
-
1
votes1
answer871
viewshow to upload python files?
what method of the request or urllib.request library do I use to upload files? (Example: upload photos to the drive automatically,or to social networks automatically or even upload videos to…
-
1
votes3
answers105
viewsError on average of students
I developed the following algorithm to calculate student averages: matricula = int (input("Digite a matrícula do Aluno: ")) nota1 = float (input("Digite a primeira nota do aluno: ")) nota2 = float…
-
1
votes0
answers207
viewsHow to make multiple dynamic graphics with Pyqt5?
I need to do four dynamic graphics on a single screen but I can’t find how to do it. I can only show one chart at a time. I used the code below as an example, but I can’t create four charts and show…
-
1
votes0
answers44
viewsHow do I remove certain lines from a csv file in Python?
I have a csv file, which contains several lines. Does anyone know what I should do to save to a new document, with some specific lines? One of the columns, 'yyyy', has data from 2015 to 2019. I…
-
1
votes1
answer196
viewsQpython 3 if/Elif/Else
Why doesn’t Mey Qpython Android accept a simple if/Elif/Else condition? I’m using Python 3. x = input('Select an option... ') if x == 1: print('xxxx') elif x == 2: print('yyyy') elif x == 3:…
-
1
votes0
answers33
viewsCreate Django app backup automatically
I developed a web application in Python and Django and I need to backup the data daily. Currently, I used the Postgres like SGBD. To perform the backup I discovered the module django-dbbackup, but…