Questions tagged as 'python'

1
answer

Overwriting property () in the child class

A few days ago I asked a similar question, but the method used to create property was via decorators ( @property and @name.setter ). Here I am creating property via function property() : from abc import ABCMeta...
asked by 15.12.2018 / 14:41
1
answer

Return substring defined by blocks in Python, in the first occurrence

In python, I'm trying to catch a substring defined by blocks, however the word "blocks" repeats in the text and would like to get the substring up to the first occurrence of it. In this example, the return causes the last occurrence: import...
asked by 28.11.2018 / 17:45
1
answer

How to monitor changes in a folder?

How can I monitor and capture changes to folders and files? I intend to use this as part of a service that starts with the system the script would be in .pyw . example: if(mudou != padrao): pass But I do not know how I would do th...
asked by 08.09.2016 / 17:14
2
answers

How to get the lowest value in a list?

I'm stuck in this program, I can not create a function in Python. The exercise is as follows:    Write a function called getMenor () that takes a list of integers and returns the least of the elements. Also, write the main program that pas...
asked by 30.06.2017 / 00:39
1
answer

Scrapy can not select a form using xpath

Hello, I'm using scrapy to make a crawler to get questions from competitors and etc from the site gabarite.com.br, I can get the description of the question the correct alternative, but I can not pick up the alternatives whenever I run in termina...
asked by 16.06.2017 / 22:20
3
answers

Maximum occurrences in a python dictionary

If I have the dictionary: meu_dic = {A:3, B:5, C:0, D:10, E:2} resulting from: meu_dic = {i:lista.count(i) for i in lista} I know A appears 3 times in the list, B 5 times, etc. How can I return the maximum number of reps and their...
asked by 27.05.2016 / 16:47
1
answer

how to make a text fit the size of the tkinter screen?

I'm doing an application in tkinter and I need the text typed in a single Label to fit the size of the window, because otherwise I have to get using line break. Can anyone help me? from tkinter import * janela1 = Tk() janela1.title("INTRODUÇÃO...
asked by 10.01.2017 / 22:36
1
answer

list assignment index out of range

A part of my Python program is: dt=1 maxt=3600*2 t=range(0,maxt,dt) r=len(t) Tsup_i=20 for i in range(1,r): Tsup[0]=Tsup_i P[i]=((I_dc)**2) * R20 * (1 + a * (Tsup[i] - (20+K))) And the error is appearing    "IndexError: list ass...
asked by 15.02.2016 / 11:51
2
answers

What to use instead of "--use-mirrors" in PIP?

When I run the following command I get the following response: sudo pip install --use-mirrors -r test-infra/requirements.txt Usage: pip install [options] <requirement specifier> [package-index-options] ... pip install [options] -...
asked by 09.03.2016 / 20:13
1
answer

Python tkinter text widget in another setting does not allow insert

I'm new to programming and to python. I would like to be able to enter a a box information that was created in another setting. How is this possible? According to the code, which is attached, the program gives an error. Thanks import tkinter a...
asked by 27.02.2016 / 20:50