Questions tagged as 'python-3.x'

1
answer

Restart in cycle for

I am doing a program which reads a file (which contains in lines words, is attached) and has to return a new file with the word in question and the sum of its characters (these I generated from a dictionary ). The problem is that it does everyth...
asked by 19.11.2018 / 20:51
1
answer

how can I substitute a date using compile_obj.subn?

I do this for fich in ficheros: coincidencias = re.search(patron, fich) #print(coincidencias) if coincidencias: print("coincide ----------------------->"+fich) Result C...
asked by 22.11.2018 / 14:10
1
answer

Sort the wildcard * in ascending numerical order

I'm using * to take all the files that start with out : We have : ['out0.jpg', 'out2.jpg', 'out4.jpg', 'out5.jpg', 'out1.jpg', 'out6.jpg', 'out3.jpg'] but I would like them to be sorted in ascending order. At the moment I am doing:...
asked by 04.11.2018 / 13:04
1
answer

Syntax error when assigning text to a Text widget

I try to make a window with scroll and it gives me a syntax error in the code: texto = tk.Label(elframe,wraplength=500,text="El ejemplo de texto ^ SyntaxError: EOL while scannin...
asked by 09.10.2018 / 20:46
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
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

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