Questions tagged as 'python'

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
1
answer

Python - Breaking down text file

Good evening, I need to separate a few lines from the file and according to the line append to another file. That is, a file containing 6 words will be added, according to the word for a specific file. These 6 words can increase to 8, 10,...
asked by 16.11.2018 / 00:43
2
answers

Python packages with dependency installation

I would like to know if as in .deb packages for example, it is possible in my setup.py I configure the dependencies for my package, and when executing: $ sudo python setup.py install They will be installed automatically. I already se...
asked by 13.11.2014 / 03:24
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
2
answers

Python, arrays / vectors and dictionaries

Hello, I'm new to python and I do not know how to do it: 1) I have a 2x6 matrix generated by random numbers, for example: matriz = [11, 4, 50, 8, 9, 78] [10, 33, 44, 57, 80, 90] What I need to do is:         when drawing a...
asked by 04.09.2018 / 21:27
1
answer

Code to generate continuous beep

The code below does the following, it reads a log file in real time and every time the line of the code has the letter N a beep emits from the windows. At first this code is working. To understand what I'm doing, I access a machine via p...
asked by 10.12.2017 / 01:34
1
answer

check if two keys of a dictionary have equal values

Hello, I have a dictionary {'A': ['B', 'C'], 'B': ['A', 'C'], 'C': ['A', 'B'] }, I would like to know if there is any way to check if for example the 'A' key and the 'C' key have the same elements and what they are. Thank you     
asked by 07.09.2017 / 19:25
1
answer

Error processing large images with openCV

I'm trying to render an orthomosaic, the problem is that the image is too large, with other smaller maps I can handle normally, but when I will render a map it greater than the error in the conversion from RGB to HSV, but this error occurs becau...
asked by 20.09.2017 / 13:42
1
answer

Login to site with POST request in python?

I would like to log in to this site link where your form: <form name="frmLogin" method="post" action="validalogin.asp" > <span>Login:</span> <span> <input title="I...
asked by 19.06.2017 / 21:31