0
  import streamlit as st
  statename = "some state name"
  d = 2000
  
  st.markdown("""
    #### "<span style="color:blue">{temp1}</span> has made {temp} calls".format(temp1 = statename, temp = str(d))    
  """,  unsafe_allow_html=True)

Here the .format is now working. The whole line is treated as a string.

Output: output

Any idea how to fix this?

darkexodus
  • 147
  • 1
  • 14

1 Answers1

2

can you try "f" other than .format as following?:

f"""
  #### "<span style="color:blue">{temp1}</span> has made {str(d)} calls"  
"""

see the output below:

  #### "<span style="color:blue">some state name</span> has made 2000 calls"

using .format:

"""
  #### "<span style="color:blue">{}</span> has made {} calls"   
""".format(statename,str(d))

or

"""
  #### "<span style="color:blue">{temp1}</span> has made {temp} calls"   
""".format(temp1=statename,temp=str(d))
Baris Ozensel
  • 433
  • 1
  • 3
  • 11