Questions tagged as 'python-3.x'

1
answer

Is it possible to use Sqlite3 on Android using the QPython3 application?

I'm trying to create a table: import sqlite3 def criar_tab_contato(conexao): cursor = conexao.cursor() sql = """ CREATE TABLE IF NOT EXISTS contato( nome text, telefone text, senha text ); """ cursor.execute(sql)...
asked by 25.10.2018 / 18:24
0
answers

Python: unittest.mock

Hello everyone, good afternoon. Require once again the wisdom and experience of the community! : D I have the following code: def save_html_file(conteudo, filename, encoding='iso8859-1'): assert isinstance(conteudo, str), '"conteudo"...
asked by 25.10.2018 / 21:36
1
answer

Optimizing data output

Good morning: I made this code for an exercise. My question is: How can I optimize the outputs without having to make multiple prints. In that code I made for three outputs. Only if it was for 10 outputs I would have to make 10 prints. Anothe...
asked by 01.11.2018 / 13:29
1
answer

Find the last position of the matrix

I'm making a game in pygame and I need to know the last position of the array for the movement of enemies. It has to be according to the size of the array, ie the last column and the first column of the array has to collide with the map edges...
asked by 24.10.2018 / 21:21
1
answer

Javascript variable in the Django template

But I'm not sure how to do that. Example of what I want to do: <!DOCTYPE html> <html> <body> <script> let showMessage = false; </script> {% if showMessage %}...
asked by 24.10.2018 / 22:52
1
answer

Change class attributes from generic method

I have a class with many attributes and would like to be able to change these attributes from a generic method where you must pass the attribute name to be changed and the new value. class Classe_com_muitos_atributos: def __init__(self, atr...
asked by 23.10.2018 / 00:00
0
answers

Error installing mysqlclient on MacOS with python 3

Error installing on macOs with python 3 pip3 install mysqlclient on MacOS iMac-de-Qcx:~ gabrielveigalima$ pip3 install mysqlclient Collecting mysqlclient Using cached https://files.pythonhosted.org/packages/ec/fd/83329b9d3e14f734...
asked by 05.11.2018 / 18:15
0
answers

Python3: How to handle relative paths with modules

I have the method below: def get_conteudo_file(filename: str, encoding: str="iso8859-1") -> str: filename = os.path.abspath(os.path.join(*filename.split(os.sep))) assert os.path.isfile(filename), "Arquivo '{}' indisponível".format(f...
asked by 18.10.2018 / 19:26
1
answer

Program crash when executing the function. Tkinter + Python3

This is the following I created a simple program to break numeric md5, but the same hangs when I click on descrypter and it only works again when it finds the hash, but it gets stuck until it finds and has hash like hash md5 of '81748856' which...
asked by 18.10.2018 / 18:18
2
answers

Importing modules with Python

How can I make import libraries, for example, I was searching and found Babel to do internationalization of dates, but I do not know how to import this library?     
asked by 07.08.2015 / 02:43