Best way is to Use a Python Web Frame Work you can choose Django/Flask. I will suggest you to Use Django because it's more powerful. Here is Step by guide to get complete your task :
pip install django
django-admin createproject buttonpython
then you have to create a file name views.py in buttonpython directory.
write below code in views.py:
from django.http import HttpResponse
def sample(request):
#your python script code
output=code output
return HttpResponse(output)
Once done navigate to urls.py and add this stanza
from . import views
path('', include('blog.urls')),
Now go to parent directory and execute manage.py
python manage.py runserver 127.0.0.1:8001
Step by Step Guide in Detail: Run Python script on clicking HTML button