Questions tagged as 'python'

2
answers

Check if a file exists, inside an IF in Python [closed]

Good afternoon, I would like to do a verification: If a file exists - delete If there is no follow the flow of the program. I'm using Pycharm, it's returning syntax error, But I've already put 4 spaces in the bottom line. Note The rest of...
asked by 05.12.2018 / 17:33
1
answer

I can not perform color conversion after rotating image

I'm developing an algorithm that rotates images by 10 degrees. For this, I am identifying the center of my region of interest, not the center of the image, because it has region of interest that are close to the songs. With this I can rotate eac...
asked by 07.12.2018 / 15:42
1
answer

How to open a txt file and use it to print what I want

I made the following code: def caixaAlta(texto): return texto.upper() def ultimosNomes(nomeInteiro): lista = nomeInteiro.split(' ') if lista[-1].lower() == 'junior' or lista[-1].lower()=='sobrinho' \ or lista[-1].lower()=='...
asked by 16.10.2018 / 15:34
1
answer

How to sort items in a list using two different values?

I have a list , which contains several values, each group of values corresponds to an audio of a language, but I am not able to sort using two conditions. audio_list = [{640: 640, 'lang': u'en', 'language': 'English', 'lang_code': 'en',...
asked by 16.10.2018 / 16:48
1
answer

SyntaxError: can not assign to operator

I'm using the following code: Levels[track][level] > UnpaidMaxSkills[track] or self.inventory[track][level] += amount I just get the error:    SyntaxError: can not assign to operator What could be happening?     
asked by 11.03.2014 / 13:04
1
answer

Pygame - Align screen in center [closed]

People are aware of how to align my game screen in the center of the desktop screen?     
asked by 06.03.2014 / 18:05
1
answer

How to calculate 'end time' in Python?

qpd = int(input('Quantidade produzida: ')) # qpd = Quantidade Produzida qpg = int(input('Quantidade programada: ')) # qpg = Quantidade Programada qrs = qpg - qpd # qrs = Quantidade Restante qpc = qrs / 550 # qpc = Quantidade por Carro mrs = i...
asked by 15.09.2018 / 01:58
1
answer

How to recognize the selected Entry

I have two data entries (password.entry, id.entry) and I want to make the program recognize which of these fields is clicked and insert the value that is inside a button in that selected field.     
asked by 20.09.2018 / 18:28
1
answer

Error presented in vscode when trying to execute a code in Python

Person, I'm trying to run some scripts in Python , but in terminal of vscode is showing the following error: bash syntax error near unexpected token (' This error is only happening on the integrated terminal of...
asked by 31.12.2018 / 17:22
1
answer

How to generate random numbers but with some restrictions in python?

import random v=[1,7,15] x=random.choice(v) How do I generate more "1" numbers than "15"? In 10000 times, choose 1 number and at the end: Number 1 should have gone approximately 40%. Number 7 must have gone approximately 30%. Number 1...
asked by 02.01.2019 / 13:05