Questions tagged as 'python-3.x'

2
answers

How to connect Mariadb with python3?

Friends, is there any way to connect Python 3 with MariaDB? Also, could you indicate any material in English or Portuguese? Thank you in advance!     
asked by 03.05.2015 / 20:01
1
answer

Transform an array to string in python

I'm trying to convert an array to a string and add the "|" at the beginning and end of each field Below the example array ['', 'C170', '1', '14879', '', '1,00000', 'UN', '29,99', '0,00', '1', '060', '1407', 'NE09', '0,00', '0,00', '0,00',...
asked by 19.01.2017 / 09:51
1
answer

Convert PDF to Text with Python

Well, I have a PDF file that is in a website, I would like to know how to get the text from this PDF and put it in a variable. Access the site with the PDF I know, my difficulty is in converting this PDF into text, or simply copying the text....
asked by 10.09.2017 / 07:45
1
answer

How to only allow one instance of a program made in Python?

Assuming I created a program in Python and it works perfectly, how do I only allow one instance of the program at a time? I searched Google and found a person saying they solved the question using PIDs, but it was not in Python and there were no...
asked by 08.07.2014 / 17:42
1
answer

List comprehension vs cycle for

I have the following code segments: def is_even(num): if(num % 2 == 0): return True return False 1. lista = range(50) pares = [i for i in lista if is_even(i)] # pares = [0, 2, 4, 6, 8...] 2. lista = range(50) pares =...
asked by 27.05.2016 / 20:07
1
answer

Probabilistic Considerations on the Calculation of Shannon's Entropy in a Network Traffic

Probabilistic Considerations for Computation of Shannon Entropy in Network Traffic I have a dump file (CAP format) of a network traffic capture made with Debian tcpdump. Until a certain time, it is attack-free traffic. Then a series of TCP SY...
asked by 23.09.2017 / 22:26
6
answers

How to install PIP in Windows 10?

I am trying to install the PIP according to the Python documentation. It is installed, but it does not work. This is always the case:    pip 'is not recognized as an internal or external command, a program   operable or a batch file....
asked by 20.09.2017 / 18:54
3
answers

Change the first character of a string by the last character in python

I have the following function: def troca(s): letra1 = s[0] letra2 = s[-1] s = s.replace(s[0], letra2) s = s.replace(s[-1], letra1) return s troca ('bar') As you can see, I provide as an argument to my function troca...
asked by 31.03.2015 / 22:14
3
answers

The operator module invokes special methods of objects

The biblioteca padrão do Python has the module operator , studying the same I noticed some of its functions have say "aliases" , for example: operator.setitem(a, b, c) operator.__setitem__(a, b, c) Set the value of a at inde...
asked by 29.10.2018 / 19:12
1
answer

How to send email with body and attachment using smtplib and email in python?

When I send a simple email in Python using only the smtplib library, I can type in the email body through the "message" argument of the script function: def enviaremail(usuario,senha,mensagem,listadestinatarios): from smtplib import SMTP...
asked by 17.01.2017 / 18:12