Skip to content
python
import streamlit as st
import os
import pandas as pd

st.title("基础示例")

st.header("页头")
st.subheader("页子标题")
st.markdown("### 段落")

st.markdown("```shell streamlit run app.py```")

st.caption("这是一个标题")

code_example = """
def hello():
    print("Hello, Streamlit!")

"""
st.code(code_example, language="python")

st.divider()


st.image("https://streamlit.io/images/brand/streamlit-mark-color.png",width=100)
st.markdown("> 远程图片")

st.image(os.path.join(os.path.dirname(__file__),"static","streamlit-mark-color.png"),width=100)
st.markdown("> 本地图片")

st.write("Hello, world!")

st.json({"name": "Streamlit", "language": "Python"})


1+1


1+1 == 2 if False else "正确"

pressed = st.button("点击1")
print('按钮1点点击',pressed)

pressed2 = st.button("点击2")
print('按钮2点点击',pressed2)

# 加载数据
df = pd.read_excel("data.xlsx")

# 显示表格
st.write(df)

# 添加一个滑块
slider_value = st.slider('选择一个值', min_value=0, max_value=100)

# 根据滑块值调整显示内容
st.write(f"您选择了: {slider_value}")

WX20250413-084300