Questions tagged as 'python'

1
answer

Generate new image centered on a point

I did a rendering and found a dot in the image that meets my criteria. I need to cut the original image into a smaller one (120x120) centered at this point. I tried the following: img = cv2.imread(path,cv2.IMREAD_GRAYSCALE) mx = pegarPontox()...
asked by 18.09.2018 / 17:24
1
answer

What is the difference between "string" and "character" in Python?

What is the difference between string and character ? For example: print 'Olá, mundo!' print "Olá, mundo!" Being both in theory are the same, right? PS: I opened the XML to do my color editing, and in the Python XML comes a color...
asked by 24.08.2017 / 23:41
2
answers

Extracting Window Values and Schedules in a Network Dump

The following network dump (PCAP file format) results from the capture of a denial of service attack in the lab: I would like to extract the time (unix time) and window value (win) and save it to a text file in the following format:...
asked by 28.05.2017 / 07:10
1
answer

Name parameter in Django's URLconfs

In the URLconf below: urlpatterns = [ url(r'^$', views.index, name='index'), ] What is the function of the name parameter? Is it possible to explain with a practical example?     
asked by 26.05.2017 / 01:58
1
answer

Transform int in byte into python

Hello, I need to convert an int value to byte. I tried to do this: import serial ser = serial.Serial('/dev/ttyACM0', 9600) angulo = 90 ser.write(angulo) #while 1 : print ser.readline() I need to send a value to the Arduino, at first,...
asked by 30.05.2017 / 01:48
1
answer

Percentage in result

I am making a menu in Python and I need the result of an account to appear in percentage .... The Tmar has value 2 and Tcliclo has a value of 7 being the result: 0.29, it by 29%. Could someone help me? Thank you def Calc3 (self,e...
asked by 15.06.2017 / 05:31
1
answer

Code review: Server with threads to handle multiple clients

The server with Threading: import socket from threading import Thread def Servidor(): servidor = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ip = "0.0.0.0" porta = 8884 servidor.bind((ip, porta)) servidor.list...
asked by 09.04.2018 / 19:29
1
answer

How to remove a specific character from some specific strings inside a list in Python?

I have an example list: ['#[Header]', '#Application Name\tLCsolution', '#Version\t1.24'] I'd like to know how to remove a specific character, such as # of all elements in the list, or, if I prefer, only some elements, such as [0:1...
asked by 16.06.2018 / 20:32
1
answer

What's wrong with this Python code?

I'm trying to create a simple project for study purposes but I'm having trouble completing it. I am using the Pytube library to download videos, I can download the videos but I can not show the download progress bar and the size of the file (v...
asked by 21.04.2017 / 16:30
2
answers

Vectors in Python

Very well, I come from C-thread, and I'm having a hard time creating vectors in python. In C if I wrote vet = [5]; I would create a vector called vet with 5 indices. I wanted to know how to do this in python but I'm a beginner and I can not do i...
asked by 06.05.2017 / 04:23