Questions tagged as 'python-3.x'

1
answer

How do you insert complex numbers in Python?

I already know that when entering a int in print it is necessary to put %i . For the float it is %f and for the string it is %s . Now how do I insert booleans and complexes? The bool and complex ?     
asked by 07.05.2015 / 22:32
1
answer

How to create a service in Python that keeps running after responding?

I need to do long-pooling on a "Home" site to receive events. I then process and filter those events and I have clients that do long-pooling on me. I need to keep this in my memory, not to persist, and to provide my clients. Regardless of not ha...
asked by 07.10.2014 / 16:45
1
answer

How do I change the width of the columns in the Admin listing in Django?

How do I specify the width for the columns that are displayed in the Admin listing, more precisely the ones I specify in list_display in admin.py. Searching a similar question here , where I came to the conclusion that I should extend the file...
asked by 19.01.2016 / 15:54
2
answers

Flask and its contexts

I'm new to desenvolvimento Web and I'm studying FLask and it has some objects that should only be manipulated in certain context like Flask.g and Flask.current_app what I can not understand are the differences between...
asked by 30.11.2018 / 21:46
2
answers

Lambda in Python - Doubt

In Python 3 study, what would be the lambda function in Python, what is it for and when is it used?     
asked by 10.12.2018 / 11:48
1
answer

Grouping of groupby pandas table

I have a table in this format User Material Nota 1 youtube 5 2 facebook 4 3 facebook 3 4 facebook 5 6 youtube 2 7 orkut 3 8 twitter 4 and would like to group so that in th...
asked by 17.07.2018 / 17:10
1
answer

bs4: How to wrap an incomplete html code?

Hello, I came across incomplete html codes where the "html" and "body" tags are missing. Here is the code I've implemented: import bs4 content=''' <head> <title> my page </title> </head> <table border="0" c...
asked by 19.06.2018 / 15:47
1
answer

Why does Python not use 100% of the processor?

I'm developing a Python application where in some snippets, it requires a lot of CPU for calculations. However, I realize that even at these "bottleneck" points, the CPU never reaches more than 50% use. Of course the program slows down, wh...
asked by 06.10.2018 / 18:57
2
answers

Show dictionary contents in sorted order according to values

I'm trying to find ways to sort a dictionary by values, then show the keys. The best way I've found so far is this: import operator def mostra_ordenado_por_valores(dic={}): if len(dic) > 0: for k, v in sorted(dic.items(), key=o...
asked by 10.11.2014 / 13:17
2
answers

Show the runtime of an Algorithm in milliseconds in python?

So far I've only found questions that show seconds. I'd like to find it in Milliseconds. Here is the code I tried: import time start = time.time() def firstDuplicate(a): dic={} for x in a: if(x in dic): return...
asked by 02.10.2017 / 02:47