Questions tagged as 'python-2.7'

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

Alignment with string.format and unicode

I'm having trouble aligning strings when using .format() , for example when doing: >>> print '{:>6}'.format('agua'} agua >>> print '{:>6}'.format('água'} água Note that the first format comes out as expec...
asked by 21.09.2016 / 16:55
1
answer

Unexpected Error using the parse_args () function of the ArgumentParser object in Python

In a simple code I'm doing in Python, I get the exception below, when I call the function parser_args() on the object of type ArgumentParser : Unexpected error: (<type 'exceptions.SystemExit'>, SystemExit(0,), <traceback...
asked by 17.11.2015 / 22:04
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
1
answer

Question: how to use python scripts for web?

I want to make a web application that will read colors in RGB of logos and create suggestions of color scales for websites. The algorithm will be in python using OpenCV. The client uploads the image > the image is read by the > the s...
asked by 07.09.2017 / 04:50
2
answers

Change border color and size Tkinter Menu

Can anyone help me with this question?     
asked by 13.10.2016 / 13:36
1
answer

How to copy the path of a selected file in Window Explorer?

How to copy the full path containing the file name to the clipboard using shortcut
asked by 28.08.2015 / 18:05
4
answers

Recursive and iterative function that calculates the factorial from 1 to n

Good people, I wanted help in a workout: Asks to create a function that calculates the factorial of numbers from 1 to n. I already have the recursive part, but I do not know how to do it to give me from 1 to n. def fatorial(n): if n ==...
asked by 07.01.2016 / 21:09
2
answers

Number divided by a divisor greater than it returns zero?

I went to do a calculation in Python 2.7 and I was scared to see the result: val = 1 / 16 print(val); # 0 Example on IDEONE That is, when we make a division where the number divided is less than the divisor, the result returned is ze...
asked by 14.04.2017 / 18:37
1
answer

Error importing xml.parsers.expat in Python 2.7 only works with Python3

Good morning, a few months ago started with python I'm using it to do tests in android applications. I have the following problem importing xml.parsers.expat . when I run directly on the terminal it works. More if I run using subprocess...
asked by 28.12.2015 / 14:44