Questions tagged as 'python'

2
answers

Matrix 4x4 is getting 20 elements

Galera made a code in Python whose exercise asked to make a 4x4 matrix, show the number of elements greater than 10 and show the final matrix. I did and it was all right only that the array is getting 20 elements and is not separated by brackets...
asked by 23.05.2017 / 19:46
1
answer

Expression to remove URL links from twitter tweet

I would like to know if anyone knows any expressions to remove links that are present in a .CSV file in the Python language. Text Ex:    joao was on the market link I want this text to appear With this I want the output to be:   ...
asked by 26.06.2017 / 16:17
1
answer

How to use the statistical distributions of scipy and matplot through array

Hello, I need to plot graphs of some statistical distributions using python3, so I checked the scipy documentation from there, after making some changes to my needs, I got the following code to perform a normal distribution: valor = [1,2,3,4,5...
asked by 30.04.2017 / 01:13
1
answer

Python parameter difference

In Python, what's the difference between Funcao(param='value') and Funcao(value) ? Or even Funcao(u'value') ? I'm starting with Python and I've seen codes with these three forms. I do not know if they were functions or meth...
asked by 14.07.2017 / 17:51
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

Read Data from a .csv file and pass line values to Tuple

The data in the cities.csv file is organized as follows: Lisbon, Madrid, 600 Madrid, Paris, 650 import csv with open('cidades.csv', 'r') as f: # Somente r para leitura do arquivo list1 = [tuple(line.values()) for line in csv.DictRe...
asked by 09.11.2017 / 02:53
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

Is it mandatory to use the decorator pyqtSlot?

When I want to connect a QPushButton to an event, for example, I use a method and add it as callback of event clicked.connect For example: def buildUi(self): self.buttonSubmitText = QtWidgets.QPushButton("Enviar") s...
asked by 24.03.2017 / 13:12
1
answer

Backtracking in Python

I'm trying to find a subset, of size M, of binary strings of length n, where any string has a distance greater than 2 for any other string in the subset. Where the distance between two strings is the number of positions where they differ. For...
asked by 24.02.2017 / 21:09
1
answer

Python Interpolate Txt

Good evening, I recently started the program in python because of an elective that I have at university, but my knowledge is still minimal. My teacher gave a job to do where I should create a code that read a table Precos.txt like this: 1, 69...
asked by 20.02.2017 / 22:58