Questions tagged as 'python-3.x'

1
answer

I wanted to improve the performance of my program

Good afternoon, I'm currently creating an interface for an application, but I'm having a problem with the function I created. def contornos(self): self.im = cv2.imread(self.imagem) im_copia = self.im.copy() imagem_cinza = cv2....
asked by 14.02.2017 / 19:01
1
answer

Lower () and strip () methods

print ("Escreva uma frase toda em maiúscula e sem espaços em branco") frase = input("Escreva uma frase: ") print (frase.lower()) print (frase.strip()) Result: Escreva uma frase toda em maiúscula e sem espaços em branco Escreva uma frase: oi...
asked by 20.12.2016 / 15:03
1
answer

How to save a hash to a file?

Code: h = {} arquivo = open("Tabela nome-idade.txt") r = True while r: nome = str(input("Nome: ")) if nome == '': r = False print(h) break idade = str(input("Idade: ")) h[nome] = idade My question is...
asked by 24.02.2017 / 02:43
1
answer

How to select and print a value from a list created by a "def"

The title is already self explanatory, how do I select and choose given str or int / float within a list that was created by my registry function def registro(cadastroaluno): matricula = input("Número de Matrícula: ") telefone = in...
asked by 23.02.2017 / 09:09
1
answer

Python: problem with list

Would anyone know how to explain and how to fix the problem in the output below when I use repeated numbers? Thank you! The return must be presented in reverse and without displaying the "0" lista=[]n=int(input("Digite um número: ")) while n...
asked by 28.02.2017 / 23:21
2
answers

How can I use two methods on the same line in python?

How could I sort the methods of the last two lines of comnetado code, so that it works in this code: # É criada a hash 'pontuações' a qual ira armazenar e ao mesmo tempo linkar os nomes as pontuações pontuações = { } arquivo = open("results.tx...
asked by 22.01.2017 / 21:31
1
answer

Access Denied when entering value in windows registry by Python

In an attempt to create a function that inserts a value into a windows registry key, I came across an error. I use Windows 8 and Python 3.5. The function is as follows: def inserir1(nome,path): import winreg key=winreg.OpenKey(winreg.H...
asked by 02.01.2017 / 21:59
1
answer

Python procedural for Class problem

I'm having trouble turning a function into a class in python: from bs4 import BeautifulSoup from selenium import webdriver import html2text # driver.page_source = driver.get())# def getPEP(strg): driver = webdriver.Firefox() driver....
asked by 12.11.2016 / 18:17
1
answer

Error "No module named 'pytube'"

When installing a package using PIP, I can not use it. Example: pip install pytube So far so good, download without problems # No IDLE: import pytube Result: Traceback (most recent call last): File "<pyshell#0>", line 1,...
asked by 02.01.2017 / 17:34
2
answers

How to include content from a page .py on another page .py

How do I make a include or open a python page in another, for example in php : include 'content/filename.php'; Load the Html it loads the file .py no, I already tried the command open fp = open('content/header.py') h...
asked by 13.11.2016 / 15:56