Questions tagged as 'python-3.x'

1
answer

Problems developing a bricks-breaking game in tkinter (collisions with objects)

I'm a few days studying and trying to get the ball by hitting the rectangles from above they add and invert the side from tkinter import * from constantes import * import random class Jogo(): def __init__(self): #Criar tel...
asked by 19.06.2018 / 14:29
1
answer

Processes in Python

I am studying the multiprocessing module and in all the examples in the Python documentation There is always a% checking in the examples, I know this checks to see if the file is being executed directly or being imported but has some...
asked by 08.08.2018 / 19:49
1
answer

Write file in JSON

I have a series of files in JSON format, so work better organize all of them into a single file using the following method: import json filename = "dados_geral.json" for mensagens in range(1,6): arq='data_gephi_%d.json' % (mensagens)...
asked by 12.12.2017 / 14:26
1
answer

How do I avoid calling the same function multiple times?

I have two script files, one for accessing a CSV file, turning each line into a dictionary, and returning a list of dictionaries (lines). My second script is a function to create a new column in the file (C1), copy the data from another colum...
asked by 28.11.2017 / 03:57
1
answer

How to import packages into other sub packages in Python?

I have the following structure in a project PacoteRaiz/ __init__.py Pacote1/ __init__.py Modulo1.py Pacote2/ __init__.py Modulo2.py If I want to, for example, use some function that is insid...
asked by 20.05.2018 / 21:36
1
answer

How to ignore certain elements in a list that will undergo a random process? (pending)

This program finds magic squares 3x3 by brute force and automatically prints when you find one. code: import random vetor = [1, 2, 3, 4, 5, 6, 7, 8, 9] def magicsquare(): return vetor[0]+vetor[1]+vetor[2]==\ vetor[3]+vetor[...
asked by 28.12.2017 / 23:38
1
answer

Threaded Exceptions in Python

I am in doubt in a situation not so common but that I have seen some developers use that is the case of concatenation of exceptions. I read the Python documentation about them but it was not as clear as Python acts behind the wipes in order t...
asked by 04.04.2018 / 18:10
3
answers

Check the line containing a string inside a TXT file

I need a help with a program that reads a file and responds in which line it contains a string inside it. Example I have a .txt file and inside it I have 5 lines: File.txt: arroz batata feijão carne laranja I need the program t...
asked by 01.04.2018 / 15:15
2
answers

How can I use the results of one function inside another in python

Good afternoon, I'm studying python alone and I'm trying to do a little program with lists and functions, the program it will get 10 names and store in a list, then 10 notes and store in another list, so far so good, the problem is that I can no...
asked by 30.09.2017 / 16:41
1
answer

How to suspend a command without disturbing commands that are active

I would like to know if you know a command in python that suspends the operation of a command (for a few seconds) without disrupting the other commands that are active, since I wanted to make a rental system but time.sleep the other commands wor...
asked by 02.11.2017 / 01:19