You’re looping through a string, which will give you one character at a time – you don’t need a loop, just get the item and print it. Here are two ways to accomplish that:
import streamlit as st
text = st.text_input("Text input", key="text_input")
if st.button("run"):
st.write(st.session_state["text_input"])
# OR
st.write(text)
Hello, thanks for your answer, if i want to put more than 2 string in a ‘session_state’ , and iterate the session_state, is there any way to get that? thanks!!
For example
st.session_state[‘key’] = ‘apple’ , ‘grape’
for i in st.session_state[‘key’]:
print(i)
I want to get ‘apple’, ‘grape’, not seperated string such as ‘a’,‘p’,‘p’,‘l’,‘e’