Questions tagged as 'python'

1
answer

Problem with zipfile logic with Python

I'm trying to make a script with python to zip xls files. I've been able to get it into the directory and it's adding everything inside a .zip file. But I wanted it to go through all the subdirectories and only bring the .xls files and no...
asked by 20.05.2018 / 16:17
1
answer

How to save averages from a dataframe, a new column containing the averages of this dataframe using pandas?

Good evening, I'm having a problem trying to save average values of a df, in a single column. An example of how I wanted it to be was: Dataframe Inthisfirstpart,Ijustopenedmydataframeandtranspiredtogetthemean()valueswiththemean()function...
asked by 22.05.2018 / 01:28
1
answer

Sort 2D vector in descending order

I have the following vector: a = [['UK', 'FR', **numero**], ['UK', 'NL', **numero**], ['UK', 'PT', **numero**]] Where the variable number are floating point values and different. I want to sort the vector elements according to the valu...
asked by 18.05.2018 / 20:54
1
answer

Error when running web application in flask - Python

Hello, I'm trying to run this application in Flask and when I try to view the page in the browser it appears server error when I delete the line of code that creates a list of items where each item is a link to another page error some, so I'm sur...
asked by 13.05.2018 / 03:12
1
answer

Why is such a simple game getting so heavy?

This is the first project I've developed using Pygame. Because it was a simple card game I expected it to be very light but not really. As I am using a very weak computer (single core 1gb ram) it is easy to see it, here it is running below 20 fp...
asked by 01.05.2018 / 16:52
2
answers

Is it possible to replace the JavaScript language with Python in web development?

Is it possible to replace the JavaScript language with Python, I mean, instead of using JavaScript to interact with the user on the webpage, is there any way I can write this interaction in Python instead of using JavaScript?     
asked by 29.04.2018 / 07:57
1
answer

How to name variables and organize them in code in what goes beyond PEP 8?

Where can I find tips for naming variables, organizing code, etc.? For example, I have a class and it has several attributes, some depend on that another attribute has been declared before, but others are independent, how could I order which...
asked by 12.06.2018 / 01:02
1
answer

Phantom repeat structure

maze = """\ ############## # # # # # ########## # # X# # ## #### # # # #### # # ############## """ EMPTY, BLOCK, STEP, END ,WALL=" ", "*", ".", "X", "#" UP, DOWN, LEFT, RIGHT = "˄", "˅", "<",...
asked by 12.04.2018 / 15:49
1
answer

Is there a way to pass a class instance as a parameter to a method in Python?

I'm doing an implementation of the algorithm A Star (A *). My question is just the title, I come from java and c ++, and I do not know how to do this in python. def transfTo(Bucket a): <------------Dúvida aqui! transf = a.total -...
asked by 17.04.2018 / 19:57
1
answer

Assign text in TXT file to a variable

Good morning! I'm running a project that is working normally but would like to automate it more to gain time in the operation. In case my project takes a text file the main words that I have described inside the "text" variable and put it t...
asked by 25.04.2018 / 15:51