Questions tagged as 'python'

1
answer

How can you check if the number in range is so fast?

It is known that with the module timeit it is possible to measure, in Python, the execution of code snippets. Curious, I've been testing how long it takes to see if a given number is in a range defined by range , such as x in r...
asked by 17.04.2018 / 03:53
2
answers

How to remove tags in a text in Python?

In PHP we have a function called strip_tags that removes HTML tags from a given text. Example: $text = "meu nome é <strong>Wallace</strong>"; strip_tags($text); // 'meu nome é Wallace' How can I remove Python text tag...
asked by 23.03.2017 / 17:30
1
answer

What is the difference of global and nonlocal in Python?

In Python, there are two statements that are used to reference variables external to the local scope: global and nonlocal . What's the difference between the two statements? When to use each?
asked by 27.10.2017 / 23:10
2
answers

How to concatenate multiple Strings in Python?

The following c.filtraNome(nome) method queries the database (sqlite3), however, I'm not sure how to group each field and return the already formatted query as follows: Nome: Fulano Silvia Idade: 19 CPF: 00000000000 Email: fulano@em...
asked by 26.08.2015 / 20:38
2
answers

Script to modify Bible texts (accessibility) [closed]

I'm not a programmer. I look for accessibility features because of my low vision. I am trying to develop a workflow that locates in the document biblical texts in the pattern "John 3:16" and transform it into "John, chapter 3, verse 16". The...
asked by 11.12.2015 / 17:14
1
answer

Why does 2 * i * i tend to be faster than 2 * (i * i) when i is integer?

The two multiplications, 2*i*i and 2*(i*i) , are equal and should generate the same result, which only changes is the order that the multiplications are made, but apparently they are treated differently by the interpreter. > In th...
asked by 03.01.2019 / 12:19
1
answer

SSL socket dying on the client and no errors on the server

I have a problem with connections to ssl sockets in python When I perform a stress test on the SMTP daemon that I am writing the client some sending threads die with " Connection reset by peer ", but server side does not there is no exceptio...
asked by 20.02.2014 / 19:03
1
answer

Pattern recognition [closed]

I have hundreds of digital images of dogs and cats, I need to make an algorithm to recognize when it is the dog and when it is the cat. What steps should I take?     
asked by 08.07.2016 / 15:38
4
answers

How to generate random numbers in Python?

I'd like to know how to generate random numbers in Python. I'm with version 3.4.     
asked by 24.07.2015 / 02:02
2
answers

Factorial Series of thehuxley.com site

Make a program that computes and writes the sum of the n first terms of the series: seriefatorial http://www.thehuxley.com/data/images/app/ problems / temp / e68085c6d699d2c7029907f994c57b80.png Input format An integer n indicating t...
asked by 04.05.2014 / 05:22