Questions tagged as 'python'

1
answer

socket error: a bytes-like object is required, not str

I'm trying to make a chat in local mode using socket but it throws me the error when I enter the message to send: Traceback (most recent call last): File "C:\Users\Angel\Desktop.py", line 8, in <module> s.send(mensaje,'rb') TypeErr...
asked by 10.10.2018 / 21:42
1
answer

Connect two applications using sockets

Well my problem is this: We are starting to see the topic of sockets and I have these examples: CLIENT: import socket host = "localhost" port = 9999 socket1 = socket.socket() socket1.connect((host, port)) try: while(True): ca...
asked by 27.10.2018 / 02:52
1
answer

Recognize words in python

I'm stuck on this problem. Your little brother has just learned to write one, two and three, in English. You have written a lot of those words in a paper, your task is to recognize them. Note that your little brother is only a child, so he m...
asked by 04.10.2018 / 17:22
2
answers

Problem when opening a program with Python

I have a problem when I try to open a program I get this error message: Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> from twisted.internet import protocol, reactor ImportError: No module named tw...
asked by 28.07.2016 / 23:45
2
answers

Save data from a csv to a list in python

I have a .csv file and from this I need to operate with the last two columns (they are digits) and without occupying "pandas", I have tried it in several ways but I do not succeed .. These are my .csv data id id2 id3 id4 1...
asked by 26.09.2018 / 03:16
1
answer

Multiply the same Matrix by N times

I am trying to multiply a matrix using numpy by itself N times, this is my current code import numpy as np fil1=3 col1=2 mat1 = random.random((fil1,col1)) mat3 = np.zeros((fil1,col1)) iter = 2 print('Matriz A:\n',mat1) for r in range(0,fil1)...
asked by 25.09.2018 / 08:27
1
answer

crop and center to square formed by points with OpenCV python

I was wanting to make a cut of a square formed by points and then center that cut on an image with opencv in python, I have a problem generating a square around the place where I have the most points. This is the original picture: And this...
asked by 19.09.2018 / 22:23
1
answer

QTableWidget, center text and change color to a specific VerticalHeader

I'm making a table with QTableWidgetItem , the problem that occurs to me is in VertialHeader I need the text to be centered and to define a different text color to some items; for example the item ( Gastos must be red)....
asked by 01.09.2018 / 07:15
1
answer

How to show a graph with pygal in QMainWindow

I'm trying to show a graph x in a QMainWindow using pygal however the graph is not shown, this is the code I'm using from PyQt5.QtWidgets import QMainWindow,QApplication from PyQt5.QtCore import QDate import pygal class Principal(QMainWindo...
asked by 07.09.2018 / 04:51
1
answer

List of lists of random numbers python

I want to know how to implement the matrizAleatoria(a) function, which completes the list of a lists with random numbers using random.random() (the function does not return anything, you only have to modify a) I wrote the...
asked by 23.10.2018 / 22:01