Questions tagged as 'python'

2
answers

Intensive python course by Eric Matthes ex8.10 [closed]

I'm having a hard time doing an exercise in the book 'Intensive python course by Eric Matthes' the exercises is as follows: 8.10 - Great Magicians: Eat with a copy of your exercise program 8.9. Write a function called make_great () that modif...
asked by 06.07.2018 / 19:19
1
answer

Generating functions: What are the advantages of using them?

Generating function: def geraQuadrados(n): for i in range(n): yield i**2 for i in geraQuadrados(5): print(i) No generating function: def novosQuadrados(n): l = [] for i in range(n): l.app...
asked by 05.04.2018 / 14:17
1
answer

Get String data from a CSV document

I have a CSV (Excel) document with valid and invalid emails. And I wanted to get the values of the fields in the form of string , but the following code gives the return shown below: import csv import re ifile = open('ead.csv', "r") read =...
asked by 03.04.2018 / 20:15
1
answer

Using the def function

I would like to create a function def for the first input and then return it on the third line. Example: def se(): sex = input('Digite seu sexo:') while sex != 'M' and sex != 'F': #não sei como se retorna esta parte:...
asked by 21.11.2017 / 18:48
1
answer

How to delete characters from a string inside a Python array

I'm starting in python and I've decided to fiddle with .txt files. I did the following procedure to insert values into an array, and from that insert each value into a line of a filename.txt file. def insertFile(): vet = []...
asked by 26.10.2017 / 18:38
2
answers

Compare Latitude and Longitude in Python

I have an application where an Android client sends the coordinates to a Python server, which should put such information in a MySQL Database if the client is within an area (a polygon of 8 vertices, to be exact), if is not within the area, it d...
asked by 05.10.2017 / 20:44
2
answers

Most Important Attributes in Random Forest Classifier

Good afternoon guys, I wonder if you can return a percentage of each attribute used in Random Forest Classifier training to show which attributes are the most deterministic.     
asked by 06.12.2017 / 17:34
1
answer

TypeError: expected string or bytes-like object DateField

I'm having a very annoying problem in Django to work with date. I am sending from my angle a date that I select in a input data . In my view , I convert the date to this format: 2017-10-13 When I try to update in my DateFie...
asked by 01.11.2017 / 15:17
1
answer

Adjust Image Range using Python

I am a beginner in python, but I have experience with other programming languages. I need to do some college work, but I do not know how to proceed. I would like to know how to adjust the range of an image using python, I downloaded some image p...
asked by 03.12.2017 / 13:46
1
answer

Create dictionaries in python using lists

I'm trying to create a translator that translates Portuguese words into binary code. I have already been able to do this to type only one word, but when I try to use 2 words, in case "ab", nothing happens. I would like to know what is missing so...
asked by 22.09.2017 / 01:00