如何从python中的原始html构造表单数据(键值对)?

问题描述 投票:0回答:1

有没有这样做的图书馆?

https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#constructing-the-form-data-set

这是我想要实现的一个例子:

data = """
<form action='/'> 
<input type='text' name='test'>
</form>
"""

x = buildformdata(data)

print(x)
{'test': ''}

我知道如何使用ex来创建它。 beautifulsoup,但也许已经做了一些事情?例如,如何转换Firefox或Chrome用于将数据构建到python中的代码?

这是执行此操作的一些代码:

https://github.com/jmcarp/robobrowser/blob/master/robobrowser/forms/fields.py

https://github.com/jmcarp/robobrowser/blob/master/robobrowser/forms/form.py#L64

python html forms
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.