Streamlight:TypeError:不支持+:“int”和“str”的操作数类型

2024-04-16 20:29:45 发布

您现在位置:Python中文网/ 问答频道 /正文

我的Streamlight应用程序中出现下一个错误:

我的错误是:

TypeError: unsupported operand type(s) for +: 'int' and 'str'

我的代码是:

import streamlit as st

if st.button("SUBMIT"):

    calculation = 23*2

    string = "Hello"

    result= (calculation + str(string))

    st.success(result)

Tags: and应用程序forstringtype错误resultint
1条回答
网友
1楼 · 发布于 2024-04-16 20:29:45

根据您的示例进行编辑:

import streamlit as st

if st.button("SUBMIT"):
    calculation = 23*2
    string = "Hello"
    result = (str(calculation) + string)
    st.success(result)

相关问题 更多 >