Home > front end >  How to pass a string into an iframe python
How to pass a string into an iframe python

Time:10-30

Basically I have a list of urls, I want to automatically pass into an iframe src, for it to process and view it. How to do that?

example :

urls_arr=['xyz.com','ybk.com']
 for i in urls_arr:
   st.markdown(<iframe src=i></iframe>)

basically i am running an app in streamlit and i am using it to embed power bi reports. the urls are actually the report embed urls.

example :

urls_arr=['xyz.com','ybk.com']
 for i in urls_arr:
   st.markdown(<iframe src=i></iframe>)

reports not opening

CodePudding user response:

You should wrap the markdown in an f-string and add unsafe_allow_html=True. something like:

urls_arr=['xyz.com','ybk.com']
for i in urls_arr:
    st.markdown(f"<iframe src='{i}'></iframe>", unsafe_allow_html=True)
  • Related