Questions tagged as 'python'

1
answer

How to detect a click or other mouse event in NotifyIcon from win32gui?

I'm trying to modify the win10toast library so that I can pass a callback that runs when the user clicks on the Windows 10 notification that I show. The "meat" of the library, which I condested as much as I could to create a minimal...
asked by 30.06.2018 / 23:59
3
answers

Sort sequence numbers from a TXT file

I have a TXT file with numbers separated by spaces and I want to sequence from the smallest number to the largest, only the numbers on the first line of that file. The sequencing logic I believe I have achieved: tam_entrada = len(lista) for i...
asked by 03.07.2018 / 04:47
1
answer

validation error in ProtoRPC

I'm getting some protorpc errors when I try to use endPoints. My code: class Application(EndpointsModel): _message_fields_schema = ('id', 'nome') criado = ndb.DateTimeProperty(auto_now_add=True) nome = ndb.StringProperty()...
asked by 04.07.2018 / 15:09
1
answer

How to get the items that multiple lists have in common

How do you do when there is no common item, posting notices? Listing 1, 2, and 3 have different index numbers. def compabilitySorter (lista1, lista2, lista3): listCompatible=[lista1, lista2, lista3] checkedItem=set() commonIt...
asked by 12.12.2018 / 13:42
1
answer

Class definition within a function or another class

I've seen in some scripts definitions of classes within other classes or functions like this: class Grok(object): class Foo(object): ... ... What is the reason for this practice? Is it just to not allow direct instantiatio...
asked by 09.07.2018 / 06:46
1
answer

Exception handling of type EOFError

while True: try: x = input().split() l.append(x) except EOFError: break I have a problem in this code where I can not get an EOF of x, because if I do not type anything and just hit enter, it still receives the...
asked by 05.07.2018 / 17:37
1
answer

Constructor method in inherited classes

Using Python3, what would be the constructor method of the Z class? class W: def __init__(self, atributo1): self.atributo1 = atributo1 def metodo1(self): print("Metodo1") class X(W): def __init__(self, atributo1...
asked by 03.09.2018 / 22:53
2
answers

Read a csv file and add your data in a dictionary

I have a code where I will have a function that will pass the data from a csv file to a dictionary. The process will take the movies with their respective notes and add to a dictionary relative to each user, and add those dictionaries to a main...
asked by 08.09.2018 / 01:50
1
answer

How to insert a counter of attempts within a Python 3 exception (except ValueError)

Hello. I am a beginner in programming and I have been trying to develop programs that I have learned in programming book exercises on my own. I did my version of the classic "Guess the number", where the user has (n) attempts to hit a number ran...
asked by 24.07.2018 / 20:11
1
answer

Django: Reverse for '' not found. '' is not a valid view function or pattern name

I'm trying to put a url based on my views.py but it returns me the error: Reverse for 'create_student' not found. 'create_student' is not a valid view function or pattern name. project urls.py: from django.contrib import admin...
asked by 20.08.2018 / 21:43