Questions tagged as 'python'

2
answers

How do I test the user type and send to different views in DJANGO's generic views

Hello, I have a question in Django. I'm trying to do it this way. My user model has a "level" field, this field has some levels, among them "root", "seller" etc .. However, I would like to know how I can restrict some views only to root, others...
asked by 02.06.2017 / 14:58
1
answer

How to use the find function to search for a dictionary entry in Python (json)?

How to use the find function to search for a dictionary entry in Python (json)? Should I use json (loads) and json (dumps)? If I type, for example, "ma" the search result would show me "Cesar Camargo Mariano", etc .. Follow the diction...
asked by 04.05.2017 / 16:13
1
answer

socket-python syntax error

except socket.error, (errno, msg): if errno == 1: # Operation not permitted msg = msg + ( " - Note that ICMP messages can only be sent from processes" " running...
asked by 05.04.2017 / 21:36
1
answer

Python library to work with video capture

Is there a Python library that is efficient (even more than OpenCV) for working with video capture and resizing it (changing the image view size without greatly changing the quality)? EDITED: In my case I want to capture the video and resi...
asked by 03.04.2017 / 14:20
1
answer

How do I solve an alternative power problem?

I need help solving a power problem in an alternate way. The purpose is to show the result of the potentiation and the number of characters (or numbers) that appear in the result. The code I'll put next I got put to work through some conversi...
asked by 10.04.2017 / 18:16
1
answer

Change coding in pd.to_datetime

I wanted to know if there is a possibility to change the encoding of an element returned by the to_datetime function of pandas. I need to change to ISO-8859-1 encoding to compare the date with others that are stored in an external file (T...
asked by 22.05.2017 / 19:18
1
answer

Reference and Parameter in Python

I have a class in Python that has a function that returns a triple (3 information together) and I wanted to create 4 different objects because I need 4 different triples. The point is that the values are accumulating and the 4th object has the i...
asked by 12.04.2017 / 00:16
2
answers

How to delete an element from an Array String?

I'm having the following compile error: del(alimentos[i]) TypeError: 'str' object doesn't support item deletion What did I do wrong? I would like to remove the typed element from the list. My code: dieta = [] alimentos = "" comer =...
asked by 12.05.2017 / 22:23
2
answers

Installation Cartopy

I'm trying to install the cartopy library. But I can not. Can someone help me? I tried for pypi and returned the following error: C:\Users\Rafa>pip install cartopy Collecting cartopy Using cached Cartopy-0.15.1.tar.gz Exception: Tracebac...
asked by 20.10.2017 / 21:38
2
answers

Is it possible to compare two variables from a view in Django?

Well, I want to compare two variables coming from a view in Django. I'm doing a for and iterating and comparing a value of type CharField (student.matricula) with another CharField (frequency.matricula)! I wondered if you could do that. My resul...
asked by 06.02.2017 / 15:13