Questions tagged as 'python-3.x'

0
answers

Thread Synchronization in python

I'm doing a program that should simulate file synchronization between two threads, but I do not know much about the python language. I've already created threads, lock methods, and files. However I can not make the run select a file at the sourc...
asked by 27.04.2016 / 15:44
0
answers

How to get nested rest?

I have classes Pessoas , Profissoes , ProfissoesPessoa and QualificacoesProfissoesPesssoa In theory, my Models are as follows: # -*- coding: utf-8 -*- from django.db import models from django.contrib.auth.model...
asked by 25.03.2016 / 20:15
1
answer

What is the lifetime of a variable in the method, in the class, and in the module?

I know that a variable declared in a method lasts for the duration of the method scope. As python has the concept of class variables, how long does a variable declared in the class last? Is a variable declared loose in a module, when it "...
asked by 07.02.2016 / 16:11
1
answer

Error installing module - egg_info

Good afternoon, I'm using python 3 through Anaconda. I need to install the pattern module and I'm trying to install it by means of eating pip. Pip install pattern I get the following error: "python setup.py egg_info" failed with error c...
asked by 14.02.2016 / 15:51
0
answers

How to calculate number of solutions of a puzzle using recursion

As a work needs to develop an algorithm that calculates the amount of possible answers to a puzzle, the game consists of an arrangement of n black / white pieces, when a piece is removed the adjacent color change, only pieces can be removed and...
asked by 24.05.2015 / 09:33
0
answers

"No module named pygame.base" - pygame and pypy

After several attempts and errors, I was able to install pygame 1.9.2a0 in pypy3, downloading the current version via mercurial and installing via / path / pypy3 setup.py But at the moment of giving import, I get the following error: Traceb...
asked by 15.03.2015 / 18:35
1
answer

Is there a way to rotate two loops at the same time in python?

I was wanting to make a kind of game that you are going to buy some things that help you to make a profit, and you would have an amount that you earn per second, but I do not know if I can run two loops (one to make interaction with the player a...
asked by 01.05.2018 / 05:45
1
answer

Function replace does not work for all cases

I made this script to read a TXT file, find a 20-digit sequence in the text, and rename the file with the digit sequence found. I used replace to remove all the characters that appear between numbers, but somehow it did not remove hyphens...
asked by 28.11.2017 / 13:33
1
answer

Error reading JSON

I'm trying to read the JSONs from a folder and get the proper values, I already tested all the JSONs to see if they were valid. The folder with the JSONs is called 'test' for dirname, dirnames, filenames in os.walk('test'): for filename in...
asked by 10.11.2014 / 16:23
2
answers

Print data from a dictionary in Python

How do I print data from a dictionary each in a column? For example: lanchonete = {"Salgado":4.50, "Lanche":6.50,"Suco":3.00,"Refrigerante":3.50,"Doce":1.00} for m in lanchonete: print (m[0]) I want to print the snacks on one column...
asked by 05.11.2018 / 15:26