Questions tagged as 'python-3.x'

1
answer

Search word with exactness

Good people I have a small text of 1859 words where I stored it all in a variable in the format string. The question and the following I have this little code I made below: w = wordstring.split() i = 0 for x in w: c = x.find('Be') if c...
asked by 11.08.2017 / 15:36
1
answer

Questions about virtualenv

I'm starting development with virtualenv and some doubts have arisen, they are: Should Python scripts be inside the virtual environment folder? In the PyCharm IDE, do you need to configure something to develop in the enabled virtual enviro...
asked by 26.07.2017 / 21:34
2
answers

Error in root account math.sqrt with multiplication and division

I am making an interface with buttons in Python, but after typing the account it gave error ... I tried to redo and it is giving indentation error. What do I need is the code correct? Follow the code! try: DEMANDA=float(self.DEMANDA.get...
asked by 16.06.2017 / 10:08
1
answer

How to extract specific data from a text file with Python?

I have a * text file of 49633 lines (file.txt) in the following format: -e Tue Mar 28 20:17:01 -03 2017 total used free shared buffers cached Mem: 239956 126484 113472 4904 1...
asked by 05.08.2017 / 22:55
1
answer

Calculate occurrences in overlapping string

I would like to know how to make as many combinations of substrings as possible within a string, eg: string = 'abcdcdc' sub_string = 'cdc' The return value I want in this case is 2, because the code should be able to check how many co...
asked by 11.11.2017 / 16:34
1
answer

Function that returns the smallest prime number. In PYTHON

Greetings, I was writing a Python code that received a number, and returned the first prime number less than or equal to that number. So (I created a function called "major_primo"), which does the following: largest_primo (100) - returns 9...
asked by 19.03.2017 / 13:37
1
answer

How to submit when pressing ENTER on a QLineEdit?

I have a certain QLineEdit in my application that, when a QPushButton is clicked, the text of it is sent to the database. But I would like to be able to add this same event by pressing ENTER on that QLineEdit . How can...
asked by 24.03.2017 / 12:47
1
answer

How to do a "time-slice" in packages in a network dump with Python?

I'm trying to "catch" source IPs and destination IPs inside a network dump (PCAP) file. The idea is to save all source IPs and all destination IPS by scanning the file every 10 minutes ("time-slice"), for example. The code below opens the dum...
asked by 03.03.2017 / 01:43
1
answer

Problem using time and print

The following code does not work as expected using Python 3.5 import time for letter in "Hello World!!": print(letter, end="") time.sleep(.5) Instead of printing each letter with a short time interval, it just pauses, and at the end...
asked by 08.07.2017 / 20:53
1
answer

Python chart does not display all desired values

I would like the graph to show only the values of the x, y coordinates corresponding to the points. But it's not like this: Forexample:ThepointwhoseXcoordinateis04/10/201709:41:00doesnotdisplaythevalueofitsYcoordinate.Thenextdotdoesnotdispla...
asked by 02.07.2017 / 19:57