Questions tagged as 'python'

1
answer

Distance count between one element and each other in a list (Python)

I have a list that symbolizes a timeline: linha_tempo = [1107, 1107, 0, 1104, 1104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1106, 1106, 0, 0, 0, 0, 0, 1102, 1102, 0, 0, 0, 0, 0, 0, 0, 0, 0,...
asked by 26.06.2016 / 16:22
1
answer

Compare values of two arrays

Hello, I need to compare 2 values of 2 arrays, but I'm not if getting: plan = [{'Cod': '11518', 'qtdPallet': '176', 'qtdLastro': '22', 'qtdCx': '12', 'Prod': 'Exemplo1', 'FC': '1'}, {'Cod': '972', 'qtdPallet': '72', 'qtdLastro': '9', 'qtdCx':...
asked by 16.06.2016 / 15:29
1
answer

Capturing user-pressed keys in Python on Linux

import pyHook import pythoncom def tecla_pressionada(evento): # print("Alguma tecla pressionada") print (chr(evento.Ascii)) hook = pyHook.HookManager() hook.KeyDown = tecla_pressionada #sem () hook.HookKeyboard() pythoncom.PumpMessages(...
asked by 05.08.2016 / 01:14
1
answer

Compare fields in two data sets

Consider two sets of data read from files of type *.CSV with Pandas . Each set has only one CPF Favorecido field, which contains millions of records. Each set of data is equal to one month. I need to find out what records (CP...
asked by 24.05.2016 / 19:11
1
answer

** optional kwargs with default

It is common to find several apis that make use of KeyWordArgument of python. My question is how to use this refuse for object attributes. Sometimes when I use an API and I pass a parameter named param=True and the class I'm instan...
asked by 19.10.2016 / 22:45
1
answer

Python --ValueError: incomplete format

Can anyone help me with this code? I have two problems: The first is the error mentioned in the title and the second is the function vector, which does not receive assignment (when I was debugging in the compiler, I realized that U was not recei...
asked by 14.05.2016 / 01:45
1
answer

Sorting the dictionary

I have the following function that I have done that is this: def funcao(elemento): x = [] for i in grafico: timestring = i["CrimeTime"] x.append(timestring) x= sorted(x) y= Counter(x).values() retur...
asked by 17.05.2016 / 11:06
1
answer

TypeError: start () missing 1 required positional argument: 'self' when trying to use the chronometer module

I installed the chronometer module 1.0 for python 3.4: chronometer module I tried to use the start () attribute of the Chronometer method, but it gives an error: it requires a 'self' argument >>>from chronometer import Chronomete...
asked by 29.06.2016 / 21:15
2
answers

Django rest and angularjs error cors

I'm using django rest and angularjs 1.x in a project, in case this backend and frontend project are isolated, I'm using a gulp server to run angularjs, but when I try to access the api rest through the $http.get of the angle, the browser...
asked by 23.07.2016 / 03:35
2
answers

PHP running PYTHON

I'm trying to run a python script through php, but it does not run python. I used the code to test: $cmdResult = shell_exec("ls & /usr/local/bin/python2.7 --version & echo done"); Returned: done LICENSE example.py When I typ...
asked by 25.07.2016 / 21:39