Questions tagged as 'python'

1
answer

How to store the result of an iteration in a new variable using python?

Good morning everyone! I'm parsing a conjunto de dados de compartilhamento de bicicletas . In this dataset there is a column named 'birthyear' , which indicates the year the user was born. I'm trying to turn this column...
asked by 09.09.2018 / 15:35
2
answers

Python - libraries without the import "*"

How do I create a library without having to import like this: from x import * or from x import y ? Only by importing import x . Who can answer me, please use the script below as a library example. def imprimir(): prin...
asked by 07.09.2018 / 04:33
1
answer

Problems starting methods in a python class?

I'm new to python and I started with classes now, I tried to start a class but for some reason always gives error, the error changes but always gives, at the moment I am with the code this way: class Inimigo: def __init__(self, vida):...
asked by 10.08.2018 / 22:57
1
answer

Can not import urlencode name in program execution

I need to run a routine, but the system tells me that it can not load the urlencode name (I'm not sure I can call this function, class), I looked for similar libraries, but I'm not sure I'm doing it correctly. from hashlib import sha256 from ur...
asked by 18.02.2017 / 22:00
3
answers

Restart application in Python

How do I restart my program with Python? cpf = input('Digite os nove primeiros dígitos do CPF: ') if len(cpf) != 9: # Aqui deve reniciar a aplicação.     
asked by 03.03.2017 / 04:04
1
answer

Problem in python's print

I have 2 inputs that receive the first and last name of a person, then the values entered are entered and the age is requested, but the print is showing name information between " Brackets ". How can I remove? This is the output Type yo...
asked by 01.01.2019 / 17:57
3
answers

Removing characters from a string - Python

Well, I have the following problem. I have a function that returns me the following output: "Address:58.200.133.200" I would like to save this value to a ip variable, but I want only the ip part from output, so I get ip = "58.2...
asked by 25.09.2014 / 21:48
1
answer

Recursive function of natural numbers is showing negatives

I need a recursive (exercise) function that prints all natural numbers between A and B : def cont(a, b): if a < b: print(a) cont(a + 1, b) cont(-3, 12) The problem is that the way I did, the negative numbers are being printed...
asked by 13.10.2018 / 20:19
1
answer

Import and manipulate json in Python

I'm trying to import an .json file with the following structure: short_description:She left her husband. He killed their children. Just another day in America. headline:There Were 2 Mass Shootings In Texas Last Week, But Only 1 On TV date:201...
asked by 30.10.2018 / 00:15
1
answer

How to create dictionary from lists

How to associate lists with keys and values to create a dictionary in Python? Is the problem the following? I have a large csv file and I need to read the first line (make it into a list) that should be used to bind to the Keys and the follow...
asked by 12.05.2018 / 17:50