所以,我用python编写了一个程序,当用户在HTML中输入值时,它就会被执行。一切正常。你知道吗
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()
但是在检查新文本文件时,R4sem和R5sem是空的。所以我的问题是,我无法读取输入的值,或者有其他方法可以做到这一点。用户会不断地使用HTML,所以值会发生变化,所以我认为使用输入是最好的解决方案。你知道吗
如果需要,我也可以把我的HTML代码。你知道吗
编辑:这是HTML代码。你知道吗
<!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>
好吧,我通过在HTML中创建所需的文本文件来解决这个问题,这样就更容易发送用户输入的值并让我交付文档。你知道吗
谢谢你的评论。你知道吗
相关问题 更多 >
编程相关推荐