从上到下而不是水平列出元素

问题描述

在编码时有些菜鸟,但是我试图从上至下而不是从左至右列出页面上的选项。

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代表“表数据”。在一行中有多个数据单元,它们将水平显示。每行只有一个数据单元,它们将垂直显示。

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...