Getting value from an input in html using python -


so, i'm making program in python executed when user gives values in input in html. runs ok.

from bs4 import beautifulsoup # parsing r = open("c:/python27/pruebas/pruebahtml.html") soup = beautifulsoup(r,"html.parser") r4sem = soup.find("input",attrs={'id':'r4sem'})["value"] r5sem = soup.find("input",attrs={'id':'r5sem'})["value"] r.close()  txt = open('c:/python27/pruebas/pruebaconfigfechas.txt','w')  encabezado = """due-date-function "dd_general"  type piecewiseconstant  multiplier 1  calculation-policy time-relative  duedate-policy foduedatetobucketendtime  attribute "fechatope" \n""" fechar4 = "\ndate -4 weeks score " fechar5 = "\ndate -5 weeks score "  txt.write(encabezado+fechar4+r4sem+fechar5+r5sem) txt.close() 

but when checking new text file, r4sem , r5sem empty. question is, can't read values inputs have or there's way this. users gonna usin html values gonna changing, thought using inputs best solution.

if needed can put html code have.

edit: here's html code.

<!doctype html> <html> <head> <title>*ajaw*</title> </head> <body>  <p>penalidadeshtml v0.1.3</p>  <div> <form action="file:///c:/python27/pruebas/dist/lectura.exe">   retraso 4 sem: <input type="text" name="r4sem" id="r4sem" value=""><br>   retraso 5 sem: <input type="text" name="r5sem" id="r5sem" value=""><br>   <br>   <input type="submit" value="grabar"> </form> </div> </body> </html> 

well, solved creating text file needed in html, easier send values user put , have document asked deliver.

thanks comments.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -