Questions tagged as 'python-3.x'

2
answers

Incorrect value conversion in python

I have a crawler that takes the value STRING $ 560,000.00 . I need to convert this value to FLOAT because I will use this value to perform queries of this type: Selecionar todos os carros com o valor entre 100000 até 560000 I am con...
asked by 03.01.2017 / 15:08
3
answers

Identify a numerical sequence in a text file

I'm new to Python, and with a problem I'm not finding a solution to. I have a folder with about 10k of .txt (written in the most varied ways). I need to extract the FIRST sequence of 17 numbers that is located in the first lines of these txt's,...
asked by 16.11.2017 / 12:20
3
answers

Doubt with variables

Hello, I have a question, it seems to be silly but this is disrupting me, I know that in Python it is not necessary to add a type to the variable, example: name = str ("Python") but I see some people declaring the same as above, is there a right...
asked by 09.01.2018 / 19:27
1
answer

What's wrong with the logic of this'Python 'code?

x = bool(input("True or False...? ")) if x == 'True': print("Você escollheu True") else: print("Você escolheu False") What is wrong with this logic, more specifically about the logic involving the Boolean variable?     
asked by 10.12.2016 / 03:14
1
answer

How to open a csv created in Python without opening an import screen?

I have already created a csv in Python in several ways as can be seen below, but every time I open the file opens the import screen as below. Why does this happen? And how can I make the file open directly within the csv defaults? Detai...
asked by 24.01.2018 / 16:40
2
answers

Which version of PIP should I use?

My current question is: should I use pip3 for Python3.x or can I also use pip without any problems? What are the differences between pip versions?     
asked by 30.09.2015 / 21:00
2
answers

How to improve this flattening function of a list

At school we are studying recursion, but of course this is never obvious. We have to create a function that "flatten" the list. I already had to see something on the net, and I resolved mine in this way: flattened_list = [] def flatten_list(l...
asked by 09.11.2014 / 20:30
1
answer

Models in Django gets everything in one file?

I'm starting my studies in Django, I come from frameworks like Rails, Laravel, Asp.Net, and I came across a difference that I even found strange in Django models being all together, is this normal? Is there a way to leave each model in a file? I...
asked by 12.12.2018 / 20:32
1
answer

How do I call the file.setter using Python to normalize the path name

Code: class Arquivos: @property def file(self): return self._file @file.setter def file(self, arquivo): if arquivo: self._file = os.path.abspath(arquivo) Call: Arquivos.file('usp/dados.json')...
asked by 21.11.2018 / 17:09
2
answers

Is it possible to create a communication between a tkinter application and a pygame?

I know that tkinter is not thread-safe , but I honestly do not know yet what that means. We are creating a game with pygame , and I would like to integrate an start menu and console written with tkinter, but I do not know if it...
asked by 04.12.2014 / 12:59