开发者

When I send a post request in python...how do I

开发者 https://www.devze.com 2022-12-12 17:16 出处:网络
Have a \"check\"? 开发者_开发问答For example... I would have a dictionary with the parameters to sent to the POST.

Have a "check"?

开发者_开发问答

For example... I would have a dictionary with the parameters to sent to the POST.

params = {'text':'how are you?', 'subject':'hi'}

then I would have

opener.open('theurl',urllib.urlencode(params))

The question is...those parameters work well with text-boxes, since I just put the value in there. How about radio buttons? How do I signify which is "checked"?


Radio buttons has values too

<input type="radio" name="music" value="Rock" checked="checked"> Rock<br>
<input type="radio" name="music" value="Pop"> Pop<br>
<input type="radio" name="music" value="Metal"> Metal<br>

for that case {"music":"Rock"} in params

0

精彩评论

暂无评论...
验证码 换一张
取 消