문제

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top