Questions tagged as 'python'

2
answers

What is "\ x" in strings in Python?

I replied a question here on the site where the following string existed in the Python language: "\xf7\x1a\xa6\xde\x8f\x17v\xa8\x03\x9d2\xb8\xa1V\xb2\xa9>\xddC\x9d\xc5\xdd\xceV\xd3\xb7\xa4\x05J\r\x08\xb0" I imagine that this \x...
asked by 10.08.2017 / 15:38
3
answers

How to format cpf correctly in python?

I have the following code: test = input ("CPF: ") When the CPF is entered: 12345678900 But when I return this input it returns: 123.456.789-00 How do I do this in Python?     
asked by 14.09.2017 / 18:05
1
answer

What is the real use of the pass in this case?

I'm working on the adaptation of a django project already created. During the code analysis I came across the following excerpt: def objects_delete_action(modeladmin, request, queryset): for obj in queryset: try: obj.de...
asked by 27.09.2017 / 15:29
2
answers

Removing duplicate elements in a list with python

I have to do a function and I am not able to develop logic. It is as follows:    Write the remove_repetitions function that receives a list of integers as a parameter, checks to see if such a list has repeated elements, and removes them. The...
asked by 24.03.2017 / 21:48
1
answer

Sine Calculation with Python

Hello, I have a problem in the sine calculation using the pyhton, I have set up a function for the sine and cosine calculation, however the result is coming wrong for the sine, while the cosine the result is right. I ended up finding that the si...
asked by 15.01.2017 / 23:44
2
answers

.pyc .pyd .pyo Extensions in Python

Given that certain extensions .pyc , .pyd , .pyo , and .py exist in Python , what are the main differences between them? What does each one represent?     
asked by 22.02.2017 / 14:39
3
answers

How to print jumping lines (each variable in a row)?

How to print jumping lines (each variable in a line)? nome ='Paulo' profissao = 'estudante' escola = 'estadual dourado' idade = 18 print 'Nome: '+nome + 'Trabalho: '+profissao + 'Escola: ' +escola+ 'Idade: '+str(idade)+ ' anos'     
asked by 08.08.2016 / 17:08
2
answers

Iterating over nested dictionaries (Pythonic)

I always get off the hook when it comes to thinking of nested loopbacks to iterate over some container (typical of C / C ++) because I know that python has very particular ways of iterating over containers. To iterate over dictionaries of dictio...
asked by 05.09.2016 / 19:33
3
answers

How to speed up a script for maximum speed in python?

I was playing around with a method to approximate the PI number and realized that the code runs very slowly in the Python 3.6 interpreter, and the process is only using 30% of the processor. Would you have a way to run this script at full thr...
asked by 27.12.2016 / 23:58
2
answers

Python Basic Request

How can I make a basic request in Python for a WebServer? I'm trying, but without success. I want to get , in the simplest way anyway.     
asked by 17.10.2016 / 19:32