Questions tagged as 'python-3.x'

1
answer

Error adding items to a Python3 .txt file

I'm trying to read a .txt file (currently empty) to check if chat_id already exists, if it already exists, it ends there. If it does not exist ... Add the new chat_id in the last line, but when I run the code and see the file, there is nothing w...
asked by 15.10.2018 / 23:42
2
answers

If a function is very extensive, is it advisable to divide it into smaller ones?

I have the following function, which I intend to extend it: def get_dataframe(site, search): if site == 'pichau': try: soup = get_page(f'https://www.pchau.com.br/catalogsearch/result/?q={search}') assert sou...
asked by 05.10.2018 / 23:56
0
answers

Automate android app with python

I'm studying python in version 3.7 and would like a python north on android. My idea would be to automate the navigation of the app using python to perform touch tasks using as reference defined images, something like java sikuli. At the mome...
asked by 05.10.2018 / 22:54
0
answers

Wait for user response on the telegram - Python

How can I expect user response after a command is executed? I'm using Python 3.6 and the telegram-bot-python lib. Example: usuario - /apel bot - Qual o seu apelido? usuario - dfop bot - Uau, seu apelido é dfop I've made it here: def ap...
asked by 09.10.2018 / 21:11
1
answer

Problem with excess houses Decimals!

Initially I was developing a python code that would help me better understand Nikola Tesla's Number Theory ( video ). Explaining quickly, starting with 360, adding each separate value results in 9, for example: 3 + 6 + 0 = 9, always dividing...
asked by 14.10.2018 / 16:30
0
answers

Problems with form Flask-Admin with additive fields in the relationship N-N

I have the models below class ProdutosIngredientes(db.Model): __tablename__ = 'produtos_ingredientes' id = db.Column(db.Integer(), primary_key=True) produtos_id = db.Column('produtos_id', db.Integer, db.ForeignKey('produtos.id'))...
asked by 03.10.2018 / 02:37
0
answers

How to perform unittest with unittest.mock for reading and writing files?

Good Night !!! This time my doubt is about unit testing. Come on. How can I test the following in the unittest.mock environment? def save_html_file(conteudo, filename, encoding='iso8859-1'): assert isinstance(conteudo, str), '"conteudo"...
asked by 08.10.2018 / 03:45
1
answer

How to make pdfkit ignore extensions?

I have the following code import pdfkit options = { 'page-size': 'Letter', 'margin-top': '0.75in', 'margin-right': '0.75in', 'margin-bottom': '0.75in', 'margin-left': '0.75in', 'encoding': "UTF-8", 'custom-header'...
asked by 02.10.2018 / 15:12
0
answers

Display relationship field 0x1, object of a filter, in a Django view

I am not able to access a field of a relationship in filter, I am bringing the objects through the context of a DetailView.    View Server class HistoricoProgressoes(DetailView): model = Servidor def get_context_data(self, **kwargs):...
asked by 01.10.2018 / 22:14
1
answer

How do I animate an object on the canvas with a bind with an animation already "rotating"

I was making a game copy of Space Invaders but when I went to do the "shot" of the ship, I came across a problem: AsseenintheGif,whenIhitthekey,everythingonthecanvas"freezes" until the shot reaches the end, how do I solve it? Thank you in...
asked by 01.10.2018 / 04:51