Questions tagged as 'python'

1
answer

Mask using flask does not load

This is the header: <script src="{{ url_for('static', filename='jquery-2.1.4.min.js') }}"></script> <script src="{{ url_for('static', filename='main.js') }}"></script></script> This is the field code that I wan...
asked by 09.10.2018 / 17:55
0
answers

Delete item from list in tempate

Hello, I have a template that shows me the items I want to donate and a final step where I confirm or delete any of these items views.py def confirm_donation(request, id): donation = get_donation(id, request.user) if n...
asked by 09.10.2018 / 18:40
1
answer

.txt file parsing using Pandas from external rules in a JSON

I have a dataset in .txt format that has its own formatting with the rules described by a separate JSON file itself. Is there any direct way to tell Pandas to use this JSON as the basis for decoding .txt? This is a piece of the .json file...
asked by 16.10.2018 / 20:37
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
1
answer

Call Python function already running

I have the following scenario. I have a function that consumes a lot of RAM and I would like to leave it running in the background for each time I call it does not have to reload all the data in memory, and when I need your result I make the...
asked by 06.10.2018 / 00:54
1
answer

IOError: [Errno socket error] [Errno 8] _ssl.c: 504: EOF occurred in violation of protocol

Hello, I'm running a simple python code (2.7.3) to throw a message through webhook in Discord and I'm encountering the following error: urlopen(url).read() File "C:\Python27\lib\urllib.py", line 86, in urlopen return opener.open(url)...
asked by 05.10.2018 / 22:22
0
answers

mmc problem in Python

In a problem I asked to make the mmc from 1 to 20, so I wrote this code: b=20 while b>0: if all(b % x ==0 for x in range(1,21)): print(b) break if any(b % x !=0 for x in range(1,21)): b +=20 However, the program only keeps ru...
asked by 13.10.2018 / 16:27
0
answers

How to use the 'len' function in a python template - Flask

I have an AppWeb in python-Flask that I would like to show the number of players online, but I'm kind of lost in this part I already tried {% len (data)%} and {% data | length%} and neither method had result. if anyone can help me in that part....
asked by 13.10.2018 / 21:15
1
answer

Movements in tkinter python

I'm getting python, and I wanted to make an interface where I have a ball that hits the walls, I just wanted to know how I can make the ball hit the walls. from tkinter import * import time tela = Tk() tela.geometry('500x500') tela.resizable(F...
asked by 03.10.2018 / 19:54
0
answers

Make a sum of the items in the shopping cart

I need to sum the prices of all shopping cart items to appear on the cart page, follow the link in my application on Heroku - link I wanted some help to do this in the best way. Follow the models and my View just below. Models Add Ite...
asked by 03.10.2018 / 21:18