<form action="EmployeeControllerServlet"> <!-- only use one form -->
<table>
<tbody>
<tr>
<td><label>Branch </label></td>
<td>
<select name="uBranch">
<option value="${loadedEmployee.branch}"></option>
<option value="IT">IT</option>
<option value="ACC">ACC</option>
<option value="HR">HR</option>
</select>
</td>
</tr>
<tr>
<td><label>Privilege </label></td>
<td>
<select name="userType">
<option value="${loadedEmployee.userType}"></option>
<option value="regular">REGULAR</option>
<option value="admin">ADMIN</option>
</select>
</td>
</tr>
</table>
</tbody>
</form>
如何使用列表理解获得def test():
return 1,2
a, b = [test() for _ in range(5)]
和a=[1,1,1,1,1]
?
答案 0 :(得分:0)
zip()
就是关键所在:
a, b = [list(x) for x in zip(*[test() for _ in range(5)])]
def test():
return 1, 2
a, b = [list(x) for x in zip(*[test() for _ in range(5)])]
print(a, b)
[1, 1, 1, 1, 1] [2, 2, 2, 2, 2]