Questions tagged as 'python-2.7'

2
answers

Remove punctuation and symbols in Python

I'm trying to remove punctuation symbols and other symbols (characters like copyright, for example) from a string. I want to leave the accented characters, the hyphen, the apostrophe ('), the white space, in addition to the letters and number...
asked by 18.04.2016 / 21:40
1
answer

UnboundLocalError: local variable 'adversary_1' referenced before assignment

I have the following code: def aleatorio(): from random import random a = random() return a def torneio(): canditado_1 = aleatorio() while canditado_1 <= 0.5: canditado_1 = aleatorio() if canditado_1 >...
asked by 21.04.2017 / 01:12
1
answer

How to add new encodings in python?

I'm trying to install pybraces but I can not. How do I install it? I'm using python 2.7 and windows 10     
asked by 17.10.2015 / 14:55
1
answer

How to sort items in a list using two different values?

I have a list , which contains several values, each group of values corresponds to an audio of a language, but I am not able to sort using two conditions. audio_list = [{640: 640, 'lang': u'en', 'language': 'English', 'lang_code': 'en',...
asked by 16.10.2018 / 16:48
1
answer

Calculating date with Python

I have a script that needs to make a difference between 2 dates collection of some files In case the script collects the date of a .txt file (dt_log) and the current date of the system (dt_sys) and my difficulty is to find the difference betw...
asked by 25.07.2018 / 20:12
1
answer

SyntaxError: invalid syntax for no apparent reason

In python, I was doing a function in trying to make a client program: AndIgotthiserror,notknowingwhy: Can someone help me?     
asked by 18.06.2018 / 00:44
1
answer

How to perform calculations on top of a CSV file with Python 2.7?

I'm learning some commands for parsing data extracted from a CSV file and trapping in the following situation: I want to use this CSV as the basis for averaging the room: Nome;P1;P2;P3 Maria;8;7;10 Julia;9.5;10;7 Ailton;7;8;10 Leo;4;5;3...
asked by 13.07.2018 / 19:47
1
answer

Moving files in folders

I have a folder called test . Within this folder there are 1000 sub-folders numbers from 1 to 1000. Inside each of these subfolders there is another folder called reports Within each reports folder there is a file called report.js...
asked by 14.05.2018 / 22:29
2
answers

I need to make an entry in Python storing as a list, all in one line

I'm doubtful in a college exercise, I need to store 3 data which are: Vehicle number, kilometers rotated and consumption in each variable of type list, but due to being different types, with the first 2 being integers and the last float, besides...
asked by 24.05.2018 / 03:19
1
answer

Simulate area of action of points in matplotlib

I need to create a graph where, given the coordinates of the points, a circle of x-ray is created around these points. Simulating the area of operation. I have the following script: ================================ import matplotlib.pyplot...
asked by 08.03.2018 / 23:15