Questions tagged as 'python'

3
answers

Lists within lists: even slicing, there is connection between lists

I am studying lists and behavior occurs that I do not understand. I know that when I link one list to another, a connection between them is created. And that when I use slicing a list, I create a copy of the list (no connection between them,...
asked by 04.11.2018 / 23:19
2
answers

Python how to print output

How can I print a list in this way, for example: l=[4,26,32] I want to print the output as follows: 4 26 32 No comma and with a blank space on the same line. Thank you in advance.     
asked by 24.02.2016 / 02:29
1
answer

How to exit a loop with hotkeys

I have an application that runs in the background in an infinite loop. How do I stop the loop using hotkeys ( Ctrl + F1 ~ F12 )?     
asked by 21.06.2015 / 04:01
2
answers

How to read and render a .txt file in the Django template?

How do I render the data of a arquivo.txt in a Django template? file content: 1;'one';'foo' 2;'two';'bar' I return in the template    1 - one - foo       2 - two - bar Any tips on where I start? Following the link...
asked by 25.06.2015 / 21:34
1
answer

ORM in Python similar to Django

I studied the framework Django a long time and found that ORM of it was excellent. I had the idea at some point to build an application with another framework called Flask , using a framework similar to Django . I...
asked by 09.05.2016 / 18:01
1
answer

Dynamic typing and team development

There is some good practice, standardization, recommendation, etc. that aims to prevent invalid types from being passed to methods and functions? If I'm working alone, it's calmer, I wrote the method myself so I know what kind of parameters i...
asked by 07.06.2018 / 21:20
2
answers

What function do I use to return or show all equal numbers in a list of 20 numbers?

n = [] for i in range(20): n.append(int(input("Digite o número: ")))     
asked by 15.05.2017 / 02:40
5
answers

How to fix the number of numeric characters of a float?

I wrote a simple code where at the end of a mathematical operation I need the result to come out with seven numeric characters regardless of where the dot is. Unfortunately I can only adjust the precision of the decimal places but I need somethi...
asked by 12.06.2017 / 23:45
3
answers

recursive function in python to calculate sum of the elements of a list

I'm having a hard time in an exercise where I should show the sum of all elements of a list recursively. The code that I just got has the basis of recursion, the recursion itself did not, because I did not understand how it could be applied t...
asked by 17.07.2017 / 18:58
1
answer

Regex custom time in python 3

I need to create a regex that accepts the following entries: 8:00 8 horas 8h 8h30 (8h 30) 8h30min (8h 30 min) 8h30minutos (8h 30 minutos) And I came up with the following: ((\d{1,2}:\d{1,2}) | (\d{1,2}\s+\bhoras\b) | (\d{1,2}...
asked by 18.08.2017 / 15:24