Questions tagged as 'python'

1
answer

Python dunders __copy__ and __deepcopy__

I have already seen in some codes, mainly in Django the dunders __copy__ and __deepcopy__ , the idea behind them I understand that provide copies of the object, but usually the dunders can be called say say% with% d of som...
asked by 08.08.2018 / 08:24
2
answers

Local variables declaration in a PYTHON function [duplicate]

def fib(n): a, b = 0, 1 while a < n: print(a, end=' ') a, b = b, a+b print() result- > 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 But if I declare variables a and b on different lines, it b...
asked by 08.08.2018 / 16:06
2
answers

How to ask questions for the user in Python, without running constantly?

I'm creating a Python code that requests the nick of a player and, as the user responds, it will receive a response, player = (input('Digite o nick desejado:')) if player == 'Phil' : print('Player encrenqueiro,nível de habilidades:razoáv...
asked by 23.03.2018 / 21:59
1
answer

Python Python too slow

Can anyone help me? I'm reading from a file, I make some changes and then saved to another folder. but this takes 2 hours, the file has 15 million lines, would it have some different and more effective method? # LER ARQUIVO NA PASTA STAGING ar...
asked by 17.10.2018 / 19:52
1
answer

How to plot the colors of each pixel in the image?

I'm working on image color recognition, so I'm converting the RGB image to Lab because it's the closest color space to human vision. After that, I get each one of the Lab's 3 channels and I want to plot in the 3D graphic the color variations tha...
asked by 13.10.2018 / 01:59
2
answers

How to display the attributes of an Exception in Python?

I am doing some exercises with exceptions created by me in Python but I did not quite understand this part of attributes in exceptions. I wanted that when the code fell into the exception, it would show a certain argument. How do I do this?    ...
asked by 21.10.2018 / 01:42
2
answers

Get X and Y from the screen using PYTHON

I want to create a bot (macro) that performs some click tasks, so I'm using pyautogui in python ! But I do not have much experience with X and Y, and I'm testing it manually and boring. I would like to get the x and y by clicking on the...
asked by 23.10.2017 / 02:54
1
answer

Is it possible to create 3d games with pygame?

Is it possible? And if it is possible do I need to know how to draw my own 3D images or is there a site that offers free 3D images?     
asked by 25.10.2017 / 13:53
1
answer

"rankear" array in Python

I have a problem and I can not solve it, it's the following I have a list of type list:    ['Words', 4], ['evidenced', 3], ['presented', 2],   [1], [1], ['performed'], [1] Where the first term is the word and the second the repetition of i...
asked by 22.09.2017 / 05:16
1
answer

Display only hours, minutes, and seconds on a chart whose entry is in unix time

Be the Python code that generates a bar chart: # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import matplotlib.dates as dates from datetime import datetime, timedelta x = [] y = [] with open("dados.csv") as f: for l in f:...
asked by 03.09.2017 / 19:37