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
votes0
answers48
viewsPython and Asyncio
I am reading the documentation from the Python library and I am finding myself in difficulty to differentiate some terms that are often used, are: Task, Future. Both terms are used in similar ways…
-
1
votes0
answers51
viewsAre tuples really immutable in Python?
t = (1,2,[4,6]) t is a tuple. If we do: t[2][0]="e" we shall have: (1, 2, ['e', 6]) Now the tuple t is (1, 2, ['e', 6]) We didn’t change the tuple? Be it s= "stackoverflow" It is not possible to do,…
-
1
votes1
answer5446
viewsPython 3 import of classes
I have three . py files in my directory: Banco.py, app.py, Usuarios.py. My app.py contains the Tkinder import that I am using in the code and here I start all my view and in it I import the class…
-
1
votes1
answer3520
viewsSave text file in Python
I am creating a simple text editor with Python and Tkinter and I want to do a function to save what was typed. I made the save function, but it only creates the txt file and does not save what was…
-
1
votes0
answers54
viewsHow to remove lines in Pyqt
I need to remove a row from Pyqt’s table. In fact it loads the lines according to the filter. But at the time it will open it pulls the ID of the lines out of the filter, how to solve this?
-
1
votes1
answer382
viewsCondition with Python letter
I want just a simple example of: test = input('Letra: ') ai if the typed letter is ' a' (here I’m having trouble) print('exemplo') I want when I type "a" to appear a message..........…
-
1
votes1
answer73
viewsWhy is the source not changed in Raspberry Pi?
I have a graphical application using Gtk in Python, the program has font definitions and font sizes. When running the program on linux works correctly, but when running on Raspberry the source is…
-
1
votes3
answers1588
viewsPython Floating Point Problem 3
I’m writing an algorithm where variable increment float in 0.2, however, after a few increments instead of incrementing 2.2 for 2.4, for example, the program increments to 2.4000000000000004 I’ve…
-
1
votes1
answer137
viewspython content management
try: with open('valores.bin', 'r+b') as arq: n = struct.unpack('i', arq.read(4))[0] arq.seek(0) for i in range(n): arq.seek(0) if isinstance(struct.unpack('i', arq.read(4)), int) and…
python-3.xasked 6 years, 6 months ago Bruno 383 -
1
votes2
answers174
viewsDoubt when ranking using Jango!
I’m making a site of a game using Jango and I want to make a ranking based on the score of all users! For now it’s like this: py views.: def index(request): perfis =…
-
1
votes1
answer1259
viewsOutput in two columns
The output of my code makes a list in a column. Code: path = '/home/allan/Área de trabalho/adjetivos.txt' i = 0 lista = [] conta = 1 with open (path) as file_obj: ler = file_obj.readlines() for le…
python-3.xasked 6 years, 8 months ago Allan Belem 61 -
1
votes1
answer168
viewsPython: Cleaning html code
Using python, what would be the easy way to clear tag parameters coming from microsoft tools? Initially I’m trying to transform via Beautiful Soup, but I’m open to all suggestions! :D In this way:…
-
1
votes1
answer3590
viewsSum all columns of an array using numpy. Is there a better way to do it?
I did so: import numpy as np #soma de todas as colunas de mat! mat = np.arange(1,26).reshape(5,5) print(mat) lista =[] for i in np.arange(0,len(mat)): lista.append(np.sum(mat[0:,i:i+1]))…
-
1
votes1
answer2179
viewsAutomate printing of files within a folder
I need to make any file that is in the folder, example c://imprimir automatically printed, check if you have something and send it to standard printer. I’ve been searching in Python but I was able…
-
1
votes2
answers180
viewsProblem with importing files into different directories
I’m having a problem using different files in different directories, this is the directory tree of my project: DeatHash ├── deathash │ ├── deathash.py │ ├── dictionaries │ │ ├── dictionary_test.txt…
-
1
votes1
answer400
viewsPlotting file . xls with matplotlib and openpyxl
Having the following content in my file . xls: Belo Horizonte - MG 2278.8 Porto Alegre - RS 1647.8 Recife - PE 2434.9 Rio de Janeiro - RJ 1653.6 Salvador - BA 2324.1 São Paulo - SP 2227.5 Total of…
-
1
votes1
answer279
viewsEncodings do not work in an Opencv file in Python 3
I followed the face detection tutorial using Opencv and wrote in Python 3. This file is not used print. I already know that Python 3 is international, is compatible with UTF-8 and does not need…
-
1
votes1
answer507
viewsCalculation of the maximum value for an expression of natural numbers using Python
Natural data m and n determine, among all pairs of natural numbers (x,y) such that x < m and y < n, a pair for which the value of the expression x*y - x**2 + y is maximum and also calculates…
-
1
votes2
answers675
viewsHow to multiply the number of lists by an integer?
If I have an input integer and an input list, it is possible to multiply the integer by the list? M = int(input()) C = (eval('[' + input() + ']')) That is, to have '’M'' lists according to the…
-
1
votes1
answer1889
viewsPrint in ascending order the natural first n which are multiples of i or j or both
Data n and two positive integers i and j different from 0, print in ascending order the first natural n s which are multiples of i or of j and or both. Example: For n = 6 , i = 2 and j = 3 the…
-
1
votes2
answers408
viewsHow to make 9 potentials quickly
I’m asking a question that asks to raise the number to 9 and say the last digit I got, but the resolution seems to have passed the time because it had number 10 9, how to solve it more quickly My…
-
1
votes1
answer1711
viewsHow to show accents in python?
I’m needing to read a file of names in python, but they’re full of accents, I’m using this to open arquivo = open('dadostxt/Nomes.txt', 'r', encoding='utf-8') i put utf-8 in encoding, but when I go…
-
1
votes4
answers365
viewsRepetition for calling variables
I have four variables [t1, t2, T3, T4], and each of them was defined as a string previously. t1 = 'A vida vai ficando cada vez mais dura perto do topo.' t2 = 'A moralidade é a melhor de todas as…
-
1
votes2
answers396
viewsHow do I solve this code in Python kivy
I’m trying to program a calendar using Python and the module kivy, but I have a problem that I don’t understand how I can solve: This is the calendar.py file: from kivy.app import App from…
python-3.xasked 6 years, 6 months ago Thitav 11 -
1
votes1
answer68
viewsCode review: Threaded server to handle multiple clients
The server with Threading: import socket from threading import Thread def Servidor(): servidor = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ip = "0.0.0.0" porta = 8884 servidor.bind((ip,…
-
1
votes1
answer168
viewsProgram to convert mp3 using multiprocessing module is looping
import subprocess from multiprocessing import Process, Lock def ConverteMusica(a,lock): input_file_fmt = '{}.mp3' output_file_fmt = a for x in range(1, 5): subprocess.call(['ffmpeg', '-i',…
-
1
votes1
answer3104
viewsPython string corrupted with character
I have a program that creates for your running another program on the user’s computer. In a snippet, I define the directory to which the new program will be intended as diret = "C:\\Users\\" +…
-
1
votes2
answers43
viewsDoubt in the logic of the script
Guys, I was wondering why the number 2 is not the first to be printed in this script, I’m not getting the logic. altura = 5 linha = 1 while linha <= altura: print ('1', end = '') coluna = 2 while…
-
1
votes2
answers6485
viewsPython - Moving files to another folder
Could someone give me a help in the code below? Goal: move files from one folder to another. I have on the desktop two folders, one called "test" and the other "teste2". At first, I have 7 text…
python-3.xasked 6 years, 6 months ago Wilson Junior 182 -
1
votes2
answers54
viewsDoubt with Lists
When I type this command in the console, it returns me an empty list. But if I create a file and have it executed, nothing appears, what happens? How should I do? lista = [] x = 1 while x > 0: x…
-
1
votes0
answers302
viewsMemoria for chat bot
I’m making a chatbot, I’ve implemented some functions and I’d like to know if there’s a waylo save what I taught him by typing the phrase and then typing the answer to when I asked the question he…
python-3.xasked 6 years, 6 months ago Léo Marques 11 -
1
votes2
answers52286
viewsWhich operator is equivalent to different in Python?
I know some other operators: Greater than: > Less than: < Equality: == But the "different" operator, as it is in Python?…
-
1
votes1
answer266
viewsSelenium + Python error when using time.Sleep()
I am automating a task on a website using python + Selenium. Every time I use the time.sleep() will run the time of Sleep returns this error. ConnectionAbortedError: [WinError 10053] Uma conexão…
-
1
votes1
answer619
viewsAssign text in TXT file to a variable
Good morning! I am running a project that is working normally, but I would like to automate it more to gain time in operation. In case my project takes in a text file the main words I described…
-
1
votes1
answer34
viewsBytearray disk size
Suppose I convert some image to bytearray. with open("img.png", "rb") as imageFile: f = imageFile.read() b = bytearray(f) print b[0] How do I know how much disk space this bytearray will take over…
-
1
votes1
answer4911
viewsEoferror type exception treatment
while True: try: x = input().split() l.append(x) except EOFError: break I’m having a problem with this code where I’m not getting an EOF from x, because if I don’t type anything and just hit enter,…
-
1
votes1
answer79
viewsCode is skipping lines - Python
Good afternoon! I would like a help in my project that seeks words (file: Variables.txt) inside of another file (Answers.txt) and marks if you find a word. But skipping a few sentences leaving blank…
-
1
votes3
answers2068
viewsPYTHON- Program that prints on screen all numbers divisible by 7 but not multiples of 5, between 3000 and 3200 (inclusive)
Hello, I’m doing the following program: The programme shall print on the screen all numbers which are divisible by 7 but are not multiples of 5 between 3000 and 3200 (inclusive). Turns out I’ve done…
python-3.xasked 6 years, 6 months ago Joao Peixoto Fernandes 111 -
1
votes1
answer5282
viewsPython - Sort string order by order of increasing number of letters
Having the following list: lista_nomes =['Manuel', 'Laura', 'Antonio', 'Jasmim', 'Maria', 'Silvia', 'Lu', 'Pancrácio', 'Diogo', 'Ricardo', 'Miguel', 'Andre'] And wanting to order it by order…
-
1
votes1
answer46
viewsPython - Complete list of each writer, along with the acronym of each person (first letter of name and surname)
Based on the list of writers described below, I have to manually create a list in which each element is a list of two elements, name and nickname. Here is the list: escritores = [['Pedro', 'Tamen'],…
-
1
votes1
answer2323
viewsWhat is the difference between Python versions 3.4, 3.5, 3.6, 3.7?
I thought Python only updated versions 2.7 to maintain compatibility but 3.x abandoned earlier versions. But he insists on updating versions 3.4, 3.5, 3.6, 3.7 constantly. What these various…
-
1
votes1
answer1460
viewsScroll (Scroll Screen) with Selenium in Python: Error
I have a list of items on the screen, in which I need to click one by one to parse data. It turns out that at some point, Selenium can’t click anymore, because when it tries, the following error…
-
1
votes0
answers74
viewsDetective: Dúvidas
Good afternoon dear! I have a big question in an activity of Python3! Follow the activity link: http://www.ic.unicamp.br/~mc102/Labs/roteiro-lab06.html First, I’ll send you my code so you can…
python-3.xasked 6 years, 5 months ago Gabriel Marangoni 11 -
1
votes1
answer2356
viewsHow to concatenate a variable to a string containing escape character
I’m new to Python, and I’m trying to set up a server socket for message exchange (like a telnet) to communicate with a client. The problem I’m facing is that this client has its own protocol, and I…
python-3.xasked 6 years, 5 months ago Gau 238 -
1
votes0
answers137
viewsVault Secret Issue - OBI 2017
I’m solving the following OBI problem: https://olimpiada.ic.unicamp.br/pratique/p1/2017/f1/cofre/ Vault Secret The secret system to open this vault is quite complex. Instead of rotating a button…
-
1
votes1
answer582
viewsHow do I pause a song in python?
I can make the program play the music, but the whole window is without function and only comes back to work when the music stops, that is to say creating a def button to pause the button only…
-
1
votes1
answer41
viewsCheck clients using python Curl
I have a list in . txt in the email|password format of my clients and want to check the integrity of some registrations. I wanted to create a variable that would take line by line from txt and…
python-3.xasked 6 years, 5 months ago user113606 -
1
votes1
answer106
viewsI can’t get the input value "csrfmiddlewaretoken"
I can’t get the input value "csrfmiddlewaretoken" from this link, could anyone help me ? " The script would basically have to visit the page that is in the code and return the value of the input…
python-3.xasked 6 years, 5 months ago user113606 -
1
votes1
answer1024
viewshow do I put a Scrollbar in a python window as if it were a web page, the more content could go down Scrollbar
I wanted that when entering the program window using Tkinter, it would be possible to use a Scrollbar to search for more items in the window so that it does not get its limited height, being able to…
-
1
votes0
answers24
viewsHttpserver gets OPTIONS from Axios and Vue-Resource
When I send a request with Axios or Vue-Resource, with the http server I end up receiving an OPTIONS instead of DELETE, POST, or PUT. Requisitions: this.$axios.put('http://192.168.0.103:3389',…