Questions tagged as 'python'

1
answer

How to break a list and transform into array in Python?

In case, I want to transform a list of a column into a 3x3 array in numerical order: lista =([[1], [2], [3], [4], [5], [6], [7], [8], [9]]) Being the expected result: ([[7 8 9] [4 5 6] [1 2 3]])...
asked by 16.04.2018 / 03:49
1
answer

Error: "illegal target for variable annotation" using "@property"

Because pygame does not have a library-like function SFML - > View , I'm developing a "camera" format to scroll the screen and preserve the positions of the objects within the general coordinate within the "world". As default for...
asked by 02.10.2018 / 23:53
1
answer

How to detect line break in Python input?

I need to read test cases in the following format: 3 1 2 3 4 52 2 1 87 10 51 32 1 36 21 34 32 12 34 45 200 (... 200 numeros separados por espaço) and so on, where the first number indicates the number of numbers to come later. Each line is...
asked by 29.09.2018 / 19:05
1
answer

Insertions in mongo how to do?

I'm doing a program that will hold numerous inserts in the mongo (about 500,000). But I realized by doing some tests, that the more entries in the mongo I have, the more time consuming the insertion. My code: def savePostRecommendation(uid,...
asked by 26.02.2018 / 20:11
1
answer

How to delimit plot area in python?

The figure is cutting the subtitles, how do I get it? # Libraries import matplotlib.pyplot as plt # Make data group_names=['0,89% - Tração Animal e Propulsão Humana', '45,08% - Passageiro e Misto',...
asked by 16.06.2018 / 23:47
1
answer

How can I call functions that are after the same function?

I have sometimes been able to call functions that are further ahead in the program. However, it takes hours to find a way to do it. What is the easiest way? Ex: def paintball(): print "Olá" adeus() def adeus(): print "Adeus" It...
asked by 16.06.2014 / 04:29
1
answer

Why is the class attribute unchanged?

I just need to send a command from one process to another, but I wanted to understand why when modifying the variable within a function, it does not appear in another function. from multiprocessing import Process import time ComandoSerial =...
asked by 18.12.2017 / 12:47
1
answer

How to make edits worth while debugging?

When I debug a code in Pycharm (Shift + F9) and make some changes, it is not recognized during the same debugging session. I am required to restart the debug again for the changes to be acknowledged. Is there any way for Pycharm to recognize...
asked by 01.08.2018 / 02:57
1
answer

What does the class name in super () .__ init __ () mean?

What is the function of the name of the classes inserted inside the parentheses of the constructor __init__( ) , in classes Telefones , TiposTelefone and Agenda ?    This is just a code snippet from Chapter 10 of "Int...
asked by 26.07.2018 / 21:59
1
answer

Convert Days and Time (Hours x Minutes x Seconds) to Time Only

I have a Dataframe where I'm making the difference between two different dates to get the difference in Hours and Minutes, for example: data_inicial = '2018-07-03 16:03:00' data_final = '2018-07-05 00:00:00' duracao = data_final - da...
asked by 05.07.2018 / 18:53