Python 3.x 如何修复:组件的children属性是一个列表列表,而不是Python中带有Plotly破折号的列表
我正在尝试用plotly和dash构建一个简单的web仪表板。以下是我试图获得的结构:Python 3.x 如何修复:组件的children属性是一个列表列表,而不是Python中带有Plotly破折号的列表,python-3.x,plotly,plotly-dash,plotly-python,Python 3.x,Plotly,Plotly Dash,Plotly Python,我正在尝试用plotly和dash构建一个简单的web仪表板。以下是我试图获得的结构: app = dash.Dash(__name__) def Build_home_page(): """ build_welcome_banner [summary] [extended_summary] Returns ------- [type] [description] ""
app = dash.Dash(__name__)
def Build_home_page():
"""
build_welcome_banner [summary]
[extended_summary]
Returns
-------
[type]
[description]
""" ""
return [
html.Div(
id="banner",
className="box",
children=[
html.Div(
id="welcome-user",
children=[
html.H1("WELCOME TO THE DATA SCIENCE"),
html.H1("AND MACHINE LEARNING PLATFORM"),
html.Hr(className="tickline"),
html.Br(),
html.P(id="welcome-text1",
children= [
"That provides you with the tools that allow you to explore your data seemlessly and"
]),
html.P(id= "welcome-text2",
children= [
"get actionable insights from your data and allows you to easily apply Machine learning models to make predictions with your data"
]),
],
),
],
),
html.Div(
id= "features",
className= "features-box-model",
children=[
html.Div(
id= "feature-text",
children= [
html.Div("Features"),
],
),
],
),
]
app.layout = html.Div(
id="get-started-page",
children=[
Build_home_page(),
],
)
if __name__ == '__main__':
app.run_server(debug=True,
use_reloader=False,
port=8080)
然后我得到了以下错误:组件的children属性是一个列表列表,而不仅仅是一个列表。检查包含以下内容的组件,并删除其中一个嵌套级别:
有什么不对劲吗?我查看了我的列表,看起来还不错!每个孩子周围都有一张单子。我不知道问题出在哪里您已经将最外层的
Div
的子项包装在列表中两次,都在Build\u主页
中,并且在布局定义中,您应该删除其中一个。如果删除后者,布局定义将是
app.layout = html.Div(
id="get-started-page",
children=Build_home_page()
)
您已经将最外层的
Div
的子项包装在列表中两次,都在Build\u主页中,并且在布局定义中,您应该删除其中一个。如果删除后者,布局定义将是
app.layout = html.Div(
id="get-started-page",
children=Build_home_page()
)