Questions tagged as 'python-3.x'

1
answer

Command to end the program

There is a command to terminate the program in Python or you can just end it by using ways like this: print()     
asked by 21.11.2017 / 17:27
2
answers

Doubt in script logic

Well, I was wondering why number 2 is not the first one to be printed in this script, I'm not understanding logic. altura = 5 linha = 1 while linha <= altura: print ('1', end = '') coluna = 2 while coluna < altura:...
asked by 21.06.2018 / 18:10
1
answer

Square Matrix in Python 3

My code is printing spaces at the beginning and end of the line, and it is giving presentation error (question 1557 URI) Does anyone have a good tip? "The values of the arrays must be formatted in a field of T size justified to the right and sep...
asked by 11.11.2017 / 14:28
1
answer

Executing external programs with Python

I would like to reduce the size of several Mp3 files in a directory with: ffmpeg -i k.mp3 -acodec libmp3lame -ac 2 -ab 16k -ar 44100 k_.mp3 where K is the name of Mp3 (k from 1 to 8): Itriedthefollowingcode:importsubprocessforxinrange(1...
asked by 14.05.2017 / 00:43
1
answer

How to create a method that pause and one that resumes a Thread?

The following script shows the x variable every 3 seconds, while the xx class running on a thread increases the value of x every second. I would like, when the value of x reaches 13, the thread where the xx class is being executed would stop....
asked by 11.02.2017 / 22:40
2
answers

Python fill values with data from other rows

Good morning, I'm having a big data failure problem on my df . I need to find the CO2 value similar to another time using conditions I can not do with the line information. I have df of 1 year with values of 30 em 30 minut...
asked by 21.03.2017 / 14:13
1
answer

Game of life, what's wrong? [closed]

I'm training Python and recently I've been trying to recreate the famous "Game Of Life", I've managed to avoid code failures but it still is not behaving correctly. The program was supposed to behave this way: link Note that the game is sti...
asked by 24.01.2017 / 02:51
2
answers

How to compress a folder with everything inside using zipfile in python?

I'm trying to compress a file and a folder that has multiple files inside it into a single .zip file using Python. The script is as follows: from zipfile import ZipFile,ZIP_DEFLATED def zipar(lista): with ZipFile('teste.zip','w',ZIP_DEFLA...
asked by 26.01.2017 / 21:59
1
answer

Why is this server crashing?

from socket import* Host = "localhost" Port = 255 sockobj = socket(AF_INET, SOCK_STREAM) sockobj.bind((Host, Port)) sockobj.listen(5) while True: conexão, endereço = sockobj.accept() print('Server conectado por', endereço) while Tru...
asked by 06.01.2017 / 15:25
2
answers

Looping for as looping parameter while

Since the list cont would have the values: cont = ['t','f','f','t','f'] You could do something like this: while(for cont in cont == 'f'): pass     
asked by 26.07.2016 / 14:30