如何解决从上到下而不是水平列出元素
在编码时有些菜鸟,但是我试图从上至下而不是从左至右列出页面上的选项。
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
代表“表数据”。在一行中有多个数据单元,它们将水平显示。每行只有一个数据单元,它们将垂直显示。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。