Posts by Marcelo Lino • 339 points
5 posts
-
1
votes1
answer3978
viewsA: Substituting values in a list
A little more streamlined than your solution lista =[-9 ,20.5, 6 ,10.8, 10, 8.0, 45, -99.6, 12, -54.7] valor_inteiro, valor_float = [float(x) for x in input('Digite um valor inteiro e um valor em…
pythonanswered Marcelo Lino 339 -
1
votes1
answer148
viewsA: how to handle a json that contains several results using python
Just change line 49: for i in resposta.get('Search'): print('teste') print_movie_data(i)
-
0
votes2
answers1755
viewsA: How to select Python 3 in Visual code
Open Settings and add the following key: "pythonPath": "/usr/bin/python3", But the correct way would be to go to the folder of your project, create a virtualenv like this: virtualenv…
-
13
votes1
answer3710
viewsA: Why use static python methods
A static method is a method that can be called without the class instance. class MyClass(object): @staticmethod def the_static_method(x): print x MyClass.the_static_method(2) It is useful to perform…
-
2
votes1
answer958
viewsA: How to catch the current user in the Django model?
You apply this logic in the view: def new_demand(request): user = request.user.id demand = NewDemand(name, date_created, date_max, user, demand_desc) So you take the ID of the logged in user and…