问题描述
在编码时有些菜鸟,但是我试图从上至下而不是从左至右列出页面上的选项。
import re
m = re.search(r'\$([\d.]+)',price)
if m:
print(m.group(0)) # to include the dollar sign
print(m.group(1)) # the amount without the dollar sign
有人可以为我提供最好的方法吗?
options currently shown horizontally
解决方法
更改此:
<tr>
{this.state.options.map((option) => {
return (
<td key={option}>
<button disabled={!this.state.optionEnabled} onClick={() => this.checkAnswer(this.state.options.indexOf(option))}>
{option}
</button></td>
);
})}
</tr>
到
{this.state.options.map((option) => {
return (
<tr>
<td key={option}>
<button disabled={!this.state.optionEnabled} onClick={() => this.checkAnswer(this.state.options.indexOf(option))}>
{option}
</button>
</td>
<tr>
);
})}
Woodrow Barlow的解释:tr
代表“表行”,td
代表“表数据”。在一行中有多个数据单元,它们将水平显示。每行只有一个数据单元,它们将垂直显示。