Python Flask请求表单:如何访问select元素的option子元素的val属性

Python Flask请求表单:如何访问select元素的option子元素的val属性,python,flask,Python,Flask,我在网上搜索,但找不到答案 我有以下HTML表单: <form action="/funcation_create_call" method="post"> <div class="form-group"> <label for="user1">Select a Provider</label> <select name="user1" class="form-control" id="user1"&g

我在网上搜索,但找不到答案

我有以下HTML表单:

<form action="/funcation_create_call" method="post">
    <div class="form-group">
        <label for="user1">Select a Provider</label>
        <select name="user1" class="form-control" id="user1">
            <option val="3">MCI MCI</option>
        </select>
    </div>
    <div class="form-group">
        <label for="user2">Select a Receiver</label>
        <select name="user2" class="form-control" id="user2">
            <option val="2">Sam San</option>
        </select>
    </div>
    <button class="btn btn-primary btn-lg btn-block" type="submit">Call!</button>
</form>

选择一个提供者
MCI MCI
选择一个接收器
三山
呼叫
以及以下Python代码:

代码:request.form.get('user1')

我的目标是能够从option元素中提取val属性(例如3),但我总是得到元素文本(例如MCI MCI)


任何帮助都将不胜感激

你是说
@Ajax1234谢谢你指出这一点。在我修正我的打字错误后,一切都按预期进行。再次感谢!!!