Questions tagged as 'python'

1
answer

Sort tuple by key in Python 3

I have a lista_tupla = [(1, [1, 2, 3, 4]), (2, [5, 6, 7]), (3, [7, 8, 9]), (3, [10, 11, 12]), (4, [13, 14, 15])] where the first index of each tuple is a key and the second index is a list as above. I would like to know: how do I sort...
asked by 17.07.2016 / 18:27
2
answers

Relate index lists in python

Good afternoon! I have the list: a=[4,3, 1, 2, 3] and the list: sub_ind_novo=[96, 7, 97, 23, 18] And I needed to list the lists getting the result: no97. G1 #When the% is 97 , the match in a is 1 , so just print 1 instead I need...
asked by 28.05.2016 / 19:18
1
answer

Rest API Django does not work

I have a problem with Python/Django . The school and school_application_info tables are related. However, there is no record with some school_id in school_application_info . So I added null=True, blank=True...
asked by 17.05.2016 / 22:22
1
answer

Define window behavior in Python when mouse is on and off

I'm using PyGTK in Python 2.7 and would like to set win.set_decorated(False) when the mouse is out of the window and win.set_decorated(True) when the mouse is over the window. How to do?     
asked by 08.06.2016 / 14:31
1
answer

I need to know the size of a file even before it is created

I have a college job and it's hard to solve ... it's kind of the wordlists that hackers use, but it's for teaching. QT: Generate a file with all possible groupings using the concept of simple arrangements in which we have n elements arranged p...
asked by 17.04.2016 / 20:31
1
answer

Vector Python 3 Fill

entrada1 = input() entrada1 = entrada1.split(" ") entrada1 = [float(numero) for numero in entrada1] Can anyone explain what's happening on line 3?     
asked by 17.04.2016 / 00:19
1
answer

Error in libpython, installing Trac, running with apache 2.4

I'm installing Trac with Apche2.4 mod_python, but when I start the service the following error appears: [:error] [pid 7937:tid 140094741256064] python_init: Python version mismatch, expected '2.7.5+', found '2.7.9'. [:error] [pid 7937:tid 14...
asked by 22.03.2016 / 19:22
3
answers

Multidimensional Array

I'm trying to create a multidimensional array. First I wanted to put all the first elements with value 2 so I did: l=4 x=6 TSup=[ [ 2 for i in range(l) ] for j in range(x) ] print TSup And I got what I expected: [[2, 2, 2, 2], [2, 2, 2, 2...
asked by 20.03.2016 / 13:57
1
answer

Character Alignment

I would like someone to tell me how I can get the numbers to align this way with the words from the top index, I'm doing a replica of this example for a college job, but I can not get numbers to align without ever expanding to off the scre...
asked by 02.04.2016 / 06:48
1
answer

Find element that ID is generated randomly

I have a situation that the id always keeps updating randomly ... and without an apparent orderimpossible I use find_element_by_id The component is as follows: <table id="treeview-2234-record-879" data-boundview="treeview-2234" data-reco...
asked by 18.01.2016 / 18:50