Questions tagged as 'python-3.x'

1
answer

How to randomly pick an item from a dictionary in Python?

I would like to know how to randomly pick an item from a Python dictionary? For example: I have the dictionary dic = {'Pedro': 99, 'João': 19, 'Rosa': 35, 'Maria': 23} I need to choose an item randomly.     
asked by 28.12.2016 / 17:05
2
answers

Decode HTML entities in a string in Python

I'm using Python 3 to access a web API. The response of the requests comes in the JSON pattern and my problem is that one of the strings is encoded with HTML entities (specifically accent). For example: "orientação-a-o...
asked by 02.12.2014 / 19:59
1
answer

Is there a standard "stack" data structure in Python?

If not, do you know a good non-standard module? I would need to work with stack , but I find it very strange that there is no standard stack (stack) module in Python and at the same time there is a queue (queue) module.     
asked by 25.11.2014 / 21:12
1
answer

What is the use of the .isidentifier () method in Python?

I came across the string .isidentifier() method and also the .isprintable() . Why use them? On what occasions would I use this?
asked by 13.08.2018 / 23:39
2
answers

Data entry without echoing on the screen

entrada = input("digite a senha") If I use the input function, what the user types will be echoed on the screen. How to make sure nothing is shown on the screen?     
asked by 10.08.2016 / 17:36
1
answer

Equation of second degree in Python

The following code computes roots, vertices, and delta of second-degree equations. The code runs clean the first time, but when I loop it to restart it gives an error: Traceback (most recent call last): File "python", line 58, in <modu...
asked by 10.09.2016 / 19:07
1
answer

running split () to form a list within another list

I have the following list: [['a:/, b:/, w:/, g:/, f:/, d:/Downloads/Torrent/End, x:/files.2t, y:/files.1t'], ['d:/Dropbox/project/rato_bat'], ['data']] But I wanted it to be a list inside another list because I did this: for a in lldi...
asked by 26.07.2016 / 20:41
1
answer

Placing elements from a list in another list

I have the following code: a = list() b = list() c = list() a = (1,2,3) b = (2,4,6) c = a + b[1] print(c) How do I add an element from a list to another list?     
asked by 17.08.2016 / 04:57
1
answer

Python - 'int' object is not iterable

Hello, I'm creating a character converter for your ascii code through a recursive function in Python. However I have an "int 'object is not iterable" problem. My code is this: def cod(n): for i in n: i = str(i) if len(n) == 1:...
asked by 09.12.2015 / 19:34
1
answer

I can not change the state of an Entry () widget in Python and Tkinter

In my code, my Entry() state is originally as DISABLED . To enable the input, the user would need to check one of checkbuttons . Well, at least that's the idea. What happens is that I mark one of the boxes, but the entry is...
asked by 17.08.2015 / 14:10