Questions tagged as 'python'

2
answers

Highlight key words from an ordered text from a ready list

I have a very basic basis that I would like to highlight the main words of each row in a prioritization list, eg: Basis: Bom dia que dia lindo vamos embora vamos chutar o dia Priority list: bom dia vamos lindo Expected resul...
asked by 21.02.2018 / 23:01
1
answer

error in math.sqrt

I'm using the math module in python, and I came up with a problem, when using math.sqrt for the root of 75, it returns me 7.5, even using float (), the root being something around 8.66 How can I fix this problem? (the values posted by the user a...
asked by 02.05.2018 / 16:57
1
answer

Python: Error translating text with api translate

I'm trying to do a translation with the api GoogleTrans ( link ). Code: # -*- coding: utf-8 -*- from googletrans import Translator translator = Translator() print translator.translate('hello', dest='pt') I get the error: UnicodeEncodeErr...
asked by 23.04.2018 / 18:15
1
answer

Python website page search engine

I want to write a Python code that accesses a particular site by placing a list of words at the end of the URL to find the pages of the site with a timer. I did however it does not return me the name of the pages. Here is the code: import requ...
asked by 11.10.2018 / 02:01
2
answers

limit the number of digits Entry - Tkinter

Hello. How do I limit the number of digits I can put in a Entry of module Tkinter ? from tkinter import * root = Tk() entrada = Entry(root) #Quero limitar para que nesse entry, possa colocar apenas 8 digitos entrada.pack()...
asked by 10.10.2018 / 00:21
1
answer

Syntax error in if and elif systems

while True: ret,img=cam.read(); gray=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) faces=faceDetect.detectMultiScale(gray,1.3,5); for (x,y,w,h) in faces: cv2.rectangle(img,(x,y),(x+w,y+h),(0,0,255),2) id, conf= rec.predict(gray[y:y+h,x:x+w]) i...
asked by 01.04.2018 / 22:25
2
answers

Array generator in Python

The program does the following: I say the number of rows and columns I want in my array and then assign a value to each column in each row, the problem is that it seems that when I specify the number of rows through the append () it creates a "fa...
asked by 09.02.2018 / 02:33
1
answer

how to remove \ n from a string in python

I'm trying to exclude control strings from (\n, \t, \u) of strings in Python and I can not do it with either replace or re.sub() . How could I do it? I've tried, and they have not worked: p = re.sub('\n', '', p) p.repl...
asked by 06.04.2018 / 17:44
1
answer

Find a specific element in a list with sub-lists (Python)

I'm fine-tuning a Pathfindig code based on A *, I need to check and modify an element within a list with several sub-lists, but I have doubts if I use a loop repetition, or if there is already some function that does this, (That returns as va...
asked by 11.04.2018 / 02:18
2
answers

How to assign 3 values to 3 variables in only one entry line in python?

# Esse é um programa que você irá digitar 3 pontuações e ele irá te informar o vice campeão (ou segundo lugar) # Existe algum método de atribuir o valor de a, b e c em apenas uma linha na entrada? # Eu escrevo na entrada por exemplo: 10 11...
asked by 15.04.2018 / 20:24