Questions tagged as 'python'

1
answer

How to construct a basic parse to treat a sentence and extract an action contained in it that will be executed?

I'm trying to mount a simple parse to parse commands entered by a user into a game of type Text Adventure . However, I've never had experience with it and I do not know if the structure and types of words I'm using are correct. The class...
asked by 08.09.2018 / 23:46
1
answer

Randomize letters

I know how to generate numbers, but how do I type letters like AB BC AEEE , for example. import random import string for j in range(40,100): print(random.choice(string.ascii_uppercase)) In this code I generate a lowercase letter. A...
asked by 10.07.2018 / 01:01
1
answer

Python asynchronous generators

With the introduction of the asyncio library, a new syntax has been introduced to define corotines in Python> = 3.5 and with it you can define asynchronous methods, asynchronous iterators, and even asynchronous generators. How can I im...
asked by 20.06.2018 / 19:33
1
answer

Method to return string of an integer value

I have a meses_dias function that receives an argument, an integer days, and returns a string that says how many weeks and days that number represents. For example, meses_dias(10) should return 1 semana(s) e 3 dias(s) I've tri...
asked by 18.04.2018 / 17:28
1
answer

How to search the Portuguese summary for the wikipedia API?

How do I get the API to return the string in pt-br? import wikipedia pesquisa=wikipedia.summary(keyword)[0:150] print(pesquisa)     
asked by 12.07.2018 / 21:32
1
answer

Selenium WebDriver error accent

I'm using Selenium WebDriver to realify test with python when executing this line: mov.find_elements_by_xpath("td")[3].text.encode('utf-8') I have the answer: {'descricao': 'PROTOCOLIZADA PETI\xc3\x87\xc3\x83O'}, When should you:...
asked by 28.08.2018 / 00:50
2
answers

Syntax error no if else

frase1 = str(input("Digite uma frase: ").strip()) frase2 = str(input("Digite uma frase: ").strip()) print("O tamanho da frase1 é " ,len(frase1)) print("O tamanho da frase2 é " ,len(frase2)) if frase1 == frase2: print("SÃO IGUAIS") else:...
asked by 06.10.2017 / 19:25
3
answers

Crawler that detects changes on a page and saves screenshots

How to make a crawler that allows you to list all ads placed on a site such as costjusto.pt (for example, in the furniture part link ) and that it tick the time that the classified appears as well as the hour (approximate to which it disappears...
asked by 12.02.2014 / 12:30
1
answer

Put in the ".txt" file the information contained in line 2 [0: 6] [closed]

Put in the ".txt" file the information contained in line 2 [0: 6] which is:    ['Memories', 'physics', 'total:', '7.988', 'MB']   ['Memoir', 'physics', 'available:', '5.277', 'MB']   ['Memory', 'Virtual:', 'Size', 'M', ':', '9.268']   ['Me...
asked by 30.11.2018 / 12:44
3
answers

I created a function in Python, but it does not execute

I was studying about the Python language and, as a test, I made a game of Jokenpô. To make it restart, I saw that I would have to put it inside a function to in the end return to it and restart the program, but for some reason when I put the...
asked by 04.01.2019 / 13:17