Python 如何在Streamlight中使用multiselect执行特定任务?
我想根据streamlight multiselect选项(特定任务)执行一个或两个操作,但我看不出我做错了什么。拜托,你知道怎么解决吗 我的代码:Python 如何在Streamlight中使用multiselect执行特定任务?,python,machine-learning,streamlit,Python,Machine Learning,Streamlit,我想根据streamlight multiselect选项(特定任务)执行一个或两个操作,但我看不出我做错了什么。拜托,你知道怎么解决吗 我的代码: import streamlit as st calculation = st.multiselect("Select one or both operations:", ('SUM','DIV')) if calculation =='SUM':st.write(2+2) elif calculation =='DIV':st.write(
import streamlit as st
calculation = st.multiselect("Select one or both operations:", ('SUM','DIV'))
if calculation =='SUM':st.write(2+2)
elif calculation =='DIV':st.write(10/2)
st.multiselect
返回包含所选选项的数组
import streamlit as st
calculation = st.multiselect("Select one or both operations:", ('SUM','DIV'))
if 'SUM' in calculation:
st.write(2+2)
if 'DIV' in calculation:
st.write(10/2)
非常感谢乔纳森·R。!