I'm learning python currently and I've made a password generator. I would like to make it so the script runs when you press a button, so you don't have to refresh the page to get a new password. I'm not sure where to start so any help would be appreciated. Below is my python script. I'm using flask.
<py-script>
num = "0123456789"
lowercase = "abcdefghijklmnopqrstuvwxyz"
uppercase = lowercase.upper()
special = "!@#$%^&*()_+~`|}{[]:;?><,. /-="
all = num+lowercase+uppercase+special
from random import choice
password = "".join(
choice(all) for i in range(16)
)
print (password)
</py-script>
