Questions tagged as 'python'

2
answers

How to create a list and put other lists in?

def annexsentence(): nome_tarefa=input("Nome da Tarefa :") data_atual = datetime.datetime.now().strftime("%d-%m-%y") data_final=input("Data Final :") estado="Aberta" lista=[nome_tarefa,str(data_atual),str(d...
asked by 01.01.2019 / 22:01
1
answer

If / else statements and time.sleep ()

I have a question. Is it possible to set time.sleep() to a if/else statement? Example: import time if time.sleep(2): print "hello" else: #alguma coisa I searched the internet but found no illuminating results.     
asked by 08.07.2014 / 17:13
2
answers

Find a value within an array of dictionaries

Hello, I'm doing the following in python: I created an array of dictionaries and would like to search within this array if a particular word exists. Ex: palavra1 = {'palavra': 'sim', 'positivo': 0} palavra2 = {'palavra': 'não', positivo:...
asked by 14.06.2018 / 15:14
3
answers

How do I insert into a nonzero position in an empty list?

How can I insert a value in a nonzero position in an empty list? Ex: lista = [] . . . lista.insert(3, 'valor')     
asked by 18.06.2018 / 05:34
1
answer

How to add elements of a list in a dictionary in Python3

Good afternoon, I'm having trouble adding elements from a list into a dictionary. The elements of the list to put in the dictionary are: ['Joao', '83889023', 'Maria', '81944356', 'Marcos', '32258899', 'Ana', '88235423', 'George', '1254345...
asked by 14.06.2018 / 20:36
1
answer

Know the smallest number with the function min ()

I want to know the least number of this list, which I present below. I do not know where I'm fooling myself, I think I need to convert the list. Example: lista=[1, 3, 5] def min(values): smallest = None for value in values:...
asked by 25.06.2018 / 18:05
2
answers

How to find out if a number is a sub-number

I would like a code, with explanation (if possible of course), to know if one number is sub number of another. Example:    P = 101   Q = 100001010057 So P is sub number of Q . Thank you in advance.     
asked by 27.02.2016 / 02:46
2
answers

Remove specific characters in Python

My question is the following, in this code snippet I'm removing a character that I specify with replace() : lista = [["de carlos,"],["des.dd carlossd,"],["Peixe, texto!"]] lista_separados = ['.',',',':','"','?','!',';'] for i, j in en...
asked by 07.10.2017 / 05:20
2
answers

Use of if __name __ == '__ main__'. Why is the class not instantiated?

I have just been using Python and there are some things that I still confuse, my question is in this code: import unittest from selenium import webdriver from selenium.webdriver.common.keys import Keys class PythonOrgSearch(unittest.TestCase)...
asked by 12.09.2017 / 17:47
1
answer

Flask is only used by beginners? [closed]

Is Flask only recommended for those who do not have experience in web frameworks, ie for small projects (academic projects) or are recommended to develop large projects (industry projects)?     
asked by 19.10.2015 / 23:43