Questions tagged as 'python'

1
answer

Read excel information in array form with python

I'm using Python 2.7 to read values from an Excel document. When I have only one line of values with its header I can read, doing from openpyxl import Workbook from openpyxl import load_workbook wb = load_workbook("Resultados.xlsx") Nod=49 #nu...
asked by 22.07.2016 / 17:25
1
answer

Database in tuple

I need a code that receives data (values) and prints them according to its key. Each entry corresponds to a hypothetical person's data, which contains Age, Name, Sex, Marital Status, Number of friends and Number of Photos. I am writing using a d...
asked by 27.04.2016 / 15:09
2
answers

how to override the save method of models

I'm trying to override the save method of models so that when a new workbook is created it will be saved and exported immediately to a .json file, this would be a form of automatic backup, but when you register a new workbook it exports all the...
asked by 21.04.2016 / 00:14
1
answer

Error sending request - get.

Considering the code below: path = "/admin/" host = "192.168.1.1" s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, 80)) req = ("GET /"+path+" HTTP/1.1\n Host: %s \r\n\r\n", host) s.send(req) print(s.recv()) s.close()...
asked by 22.05.2016 / 00:59
1
answer

Scrapy 1.0 - Log Settings

I need to know how I can do to change the highlighted fields, because when I run my program with Scrapy in version 1.0 it printed the result in these highlighted quantities. I wanted to know how to change them, whether it's through a sc...
asked by 29.03.2016 / 15:10
2
answers

Separate rows of files in tokens - Python

I want to read the line from a file and store each word or information in a vector position. Ex: "18-10-2015 00092 65534". line [1] = 10-18-2015 line [2] = 00092 line [3] = 65534 NOTE: tabbing between strings     
asked by 14.03.2016 / 16:52
1
answer

Convert to list a string from a list that contains base64?

I get a json request with a request.POST that comes as a base64 string list. I can convert to string with str(request.POST['imagem']) which results something like this:   <   ...] With the AST library on any other li...
asked by 25.05.2016 / 20:54
2
answers

Elements of B whose indices are the positions of occurrences of equal elements in A

If I have the lists: A = [12, 15, 10, 15, 12, 10, 10, 10, 15, 12, 12, 15, 15, 15] B = [0.2, 0.3, 1.1, 0.2, 0.2, 0.7, 0.4, 0.6, 0.1, 0.3, 0.7, 0.4, 0.5, 0.5] How can I group the values of B that are in the repeated element posi...
asked by 06.04.2016 / 16:58
1
answer

Remove duplicates from a list by keeping the order

I had the list: A = [12, 15, 10, 15, 12, 10, 10, 10, 15, 12, 12, 15, 15, 15] , when doing: ASemRepetidos=set(A) I get ([10, 12, 15]) , as seen, if in A my first element is 12, in set(A) becomes 10, or I...
asked by 08.04.2016 / 12:56
1
answer

Adding positives in an interval using just while

I need to write a program using a loop ( while ) that receives two numbers as input, and can be positive or negative and not necessarily in ascending order, and the program should print the sum of all positive numbers in that range. I star...
asked by 19.03.2016 / 15:26