Writing text on multiple lines in an error message

I would like to know if it is possible to write multiple lines of text (with each sentence appearing on a new line) in an error message.

I have tried the following code to achieve this, but have been unsuccessful:

import streamlit as st  

st.error("Line 1a\n"
         "Line 2b.")

st.error("Line 1c\n Line 2d.")

@rik try like this ‘’’ line 1
line 2
line 3
‘’’

like
st.write(‘’‘# San Francisco Crime Classification
This app predict top 5 crime in San Francisco.
‘’’)

@MuhammadAmmar26627 I tried that and it did not work.
FYI it is with the st.error method that I would like to display text with, not st.write

@rik This will do

st.error('''
Line 1  
Line 2
''')

The thing is in Markdown leave 2 spaces and go to the next line will add a new line. In the code, I have added 2 spaces after Line 1.

1 Like