Questions tagged as 'python'

1
answer

Search within a pdf with Python

I read an encrypted Pdf and when looking for the list below it tells me that it does not find anything, it seems to me that my regular expression is wrong import PyPDF2 import re file = open('imagen.pdf', 'rb') pdfreader = PyPDF2.PdfFileReade...
asked by 30.05.2017 / 18:51
2
answers

How to remove an item from a list that is linked to another without losing that data in the other list?

Hello friends, I hope you can help me with this. I have this object class Player(Game): """docstring for Jugador""" def __init__(self, name, sex): self.name = name self.sex = sex self.points = 0 self.efectividad = 0 self...
asked by 02.06.2017 / 21:42
2
answers

How to transform a SQL query into a panda dataframe matrix?

I want to set an array from a postgresql database so that we have the eclipse_id by the heading and the subscriber_id by the side. > data.head(6).ix[:,2:8] 1222 52582 45552 122 589 568 0 0 0...
asked by 01.06.2017 / 18:30
1
answer

Center graph Pertersen in jupyter

I would like to know how I can make the graph go straight and not tilted as it is. I'm doing it with the IDE Jupyter and Python 3.6. This is the code: import networkx gP = { 1: [2,5,6], 2: [3,1,7], 3: [4,2,8], 4: [5,3,9], 5: [1,4,10],6: [1...
asked by 07.06.2018 / 15:27
1
answer

send a message to the client from the server with the use of sockets in python 3.6

Hi I do not understand why my server reasoned #servidor import socket host = "127.0.0.1" port = 6666 sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print ("Socket Created") sock.bind((host, port)) print ("socket bind complete") soc...
asked by 12.04.2017 / 23:55
1
answer

Use input () within a for cycle (Python)

I am trying to create a matrix in which the user enters the number of rows, columns and each term: colum=int(input('Cantidad de columnas: ')) fil=int(input('Cantidad de filas: ')) matriz=[[str(input('[',i,',',j,']-esimo termino: ')) for i in r...
asked by 30.03.2017 / 16:15
1
answer

Error in inRange () "TypeError: unknown is not a numpy array"

I am doing a motion detector program but I have an error in the following part of the code: rang = cv2.inRange(flow,20,255) Error: TypeError: <unknown> is not a numpy array Annex code: import cv2 import numpy as np cap = cv2...
asked by 26.03.2017 / 11:32
1
answer

Problem by immutable string ... python

Good, I'm doing a code and I have encountered a problem because of the immutability of a string and can not avoid it. I put the code and explained: def muevecoche(letramov,nveles,guarda): elemento = nvles[guarda] for poyito in range...
asked by 24.03.2017 / 20:42
2
answers

Problems with query in django

In the database I have these values INSERT INTO 'principal_ingresos' ('id', 'instalacion_id', 'natural', 'juridico', 'fecha') VALUES (1, 1, 1066, 0, '2017-01-04'), (2, 1, 754, 0, '2017-02-08'), (3, 1, 1253, 0, '2017-03-09'), (4, 2, 2504, 0, '2...
asked by 03.05.2017 / 15:48
1
answer

Doubt with sorted when sorting list of integers in the form of strings

I have this list A : A = ['-1', '-2', '-2', '1', '1', '10', '100', '20', '4'] If I put sorted(A) I get this ['1', '1', '-1', '20', '4', '-2', '-2', '10', '100'] I tried this list: lista = ['3', '2', '5', '6', '7'] and...
asked by 31.01.2018 / 05:30