如何在html标记中调用python函数

如何在html标记中调用python函数,html,python-3.x,django-templates,Html,Python 3.x,Django Templates,我已经创建了一个函数来提取pdf文本,但我无法在html页面上显示输出。 在html文件中- 文件名=userInput.html <form action=""> <label for="usr">Select PDF File:</label> <input type="file" id="PDFupload"> <input type="

我已经创建了一个函数来提取pdf文本,但我无法在html页面上显示输出。 在html文件中- 文件名=userInput.html

<form action="">
  <label for="usr">Select PDF File:</label>
  <input type="file" id="PDFupload">
  <input type="submit" id='file_submit'> 
</form>
<label>Extracted Data From Selected PDF File</label>
<input type="text" placeholder="Text Data of PDF">
现在我想在html页面上显示输出文本,其中placeholder=“PDF的文本数据” 我试着用

  • 脚本中的src=“python.py”type=“text/python”
  • 布莱顿
  • 德扬戈
  • bs4
  • 我正在寻找代码、html和python。但我只得到一个边代码,因此无法正确链接

    #!c:\Program Files\Python39\python.exe
       def pdf_on_html():
           import PyPDF2
           a = PyPDF2.PdfFileReader('select file from html page where id="PDFupload"')
           print(a.getPage(0).extractText())
       pdf_on_html()