Hi , streamlit noob here , how can I get the input from user and store it into a list and print out?

For example ,

user type : Hello

output : Hello

user type : 2

output : Hello
output : 2

user type : World

output : Hello
ouput : 2
output : World

Thanks !!!

Hi @Root
Just following this video, do any one of the parts and you should be good to go with using streamlit!

Thanks but I managed to do something like what I wanted using session_state …

import streamlit as st
from streamlit_chat import message

message(“Welcome to Streamlit-Chat”)

if ‘message_history’ not in st.session_state:
st.session_state.message_history =

for message_ in st.session_state.message_history:
message(message_,is_user=True) # display all the previous message

placeholder = st.empty() # placeholder for latest message
input_ = st.text_input(“you”)
st.session_state.message_history.append(input_)

with placeholder.container():
message( st.session_state.message_history[-1], is_user=True) # display the latest message