破折号,将输入另存为变量

时间:2019-06-21 15:20:53

标签: python plotly-dash

我在Jupyter上有一个类似这样的代码:

Init
[0] by SpawnPoolWorker-4
[1] by SpawnPoolWorker-2
[2] by SpawnPoolWorker-1
[3] by SpawnPoolWorker-3
[4] by SpawnPoolWorker-5
[5] by SpawnPoolWorker-6
[6] by SpawnPoolWorker-7
[7] by SpawnPoolWorker-8
[8] by SpawnPoolWorker-10
-[7] by SpawnPoolWorker-8
[9] by SpawnPoolWorker-8
-[5] by SpawnPoolWorker-6
-[2] by SpawnPoolWorker-1
-[0] by SpawnPoolWorker-4
-[9] by SpawnPoolWorker-8
-[4] by SpawnPoolWorker-5
-[8] by SpawnPoolWorker-10
-[6] by SpawnPoolWorker-7
-[3] by SpawnPoolWorker-3
-[1] by SpawnPoolWorker-2
Done

现在,我想将此代码在线发布给同事,但我从未使用过Dash。用户只应:

You input a keyword
The code makes a couple of API calls based on the keyword
The code merges and wrangles the optained databases
The code plots with Plotly

我需要将输入另存为变量,但是该怎么做呢?我正在关注以下示例:

Use an input box
Press confirm
Obtain the graphs

是否可以将框中的值另存为python变量?谢谢

1 个答案:

答案 0 :(得分:0)

当然。您可以这样更改回调函数:

android:layout_marginTop="?attr/actionBarSize"

给它一个你喜欢的名字,然后像任何Python变量一样从那里使用它。

编辑: 也许我应该提到arg @app.callback( Output(component_id='my-div', component_property='children'), [Input(component_id='my-id', component_property='value')] ) def update_output_div(input_value): my_variable = input_value return 'You\'ve entered "{}"'.format(my_variable) 已经是一个Python变量,您可以像使用其他变量一样使用它。