Questions tagged as 'python'

1
answer

More elegant ways to reverse integers, arrays, and strings in Python

Save! I've been looking for elegant ways to reverse strings, arrays, and integers in Python. What do you think of my codes below and what do they suggest to improve them? They work ... Thank you! frase = 'eu gosto de python'[::-1] num...
asked by 28.10.2015 / 00:33
1
answer

Python2.7 with OpenCV 3.3.0 - VideoCapture problem

I'm running OpenCV 3.3.0. with Python 2.7 on a Windows 7 Professional x64 machine, and when I run the code below, it falls on the prints "Something went wrong" and "Finished ..." import cv2 capture = cv2.VideoCapture("video.mp4") #The video i...
asked by 08.09.2017 / 20:15
1
answer

Sort dictionary by value and use rule if value is first python [duplicate]

I want to make a dictionary in python in which it will have diseases and scores ex: dic ['alzhelmer'] = 3 Dic ['flu'] = 5 The program should sort the diseases that scored the least to the least (descending) in the dictionary ex: Dec ['fl...
asked by 09.09.2017 / 20:26
1
answer

Exporting data in json or txt, in python?

I need help learning how to export data from an object. At first I need to export in type "txt" and / or "json", but I could not succeed in either. The code: #coding = utf-8 import json . . . def arquivo(lista_nomes): print(json.dump...
asked by 10.09.2017 / 02:35
1
answer

Loop reverse selenium python

I'm trying to loop back my list of li in selenium and it's not rolling. I already tried a reversed in the list but the error. I want to loop the last li to the first one. For example, in the list below: <ul id="li...
asked by 01.09.2017 / 18:54
1
answer

Input of numbers on the same line in python [closed]

I need to read three values in a single variable, the third with a comma. Input: Two rows of data. In each line there will be 3 values, respectively two integers and a value with 2 decimal places. EX: 12 1 5.30 Exit Value: EX: VALUE TO PAY: R...
asked by 19.08.2017 / 23:17
1
answer

Error object is not subscriptable

Hello Please, I want to write a csv file from a list, but this error appears: --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-i...
asked by 22.08.2017 / 22:58
0
answers

How to stop a progressbar in Tkinter

I've always been developing in JS a little lost here in Python, if you can help me ... I wanted to leave the button close without an event until the progress bar is gone, and the progress bar on completion is "indeterminate" #Loading pa...
asked by 13.08.2017 / 22:34
0
answers

Apache, Python and mod_wsgi

Sirs, I use simple web applications running on Apache2 and with PHP on the server to automate trivial tasks on my work team. I use PHP only for LDAP and BD requests, using jQuery, lodash and pure JS for everything else. I'm migrating many bases...
asked by 14.08.2017 / 01:40
0
answers

How to block user login with certain status in Django

I'm using Django 1.11 and views based on classes. My user model is customized and it has a "status" field where it has "enabled, blocked and disabled". I would like to know how I can only allow users to log in and the others are barred. It's...
asked by 08.08.2017 / 21:01