Displaying Python Lists

Hi,

I’ve had a go at doing this myself but I think I’m being silly. I have a python list which contains filenames, I want to display each of these items on the dash.

I’ve been trying to the use the function LI() from the dash_html_components library.

I was thinking I might need to convert the python list into a html list, which I can brute force but was wondering if there was a different way.

My end goal is for each item in the list to be a link that the user can click and download, but just want to do this first.

Thanks for your help,
Shan

Hi, of course you can do that. Not sure how you want to to format the list, maybe like this:

  1. item1
  2. item2
  3. item3

The code is:

dcc.Markdown('''
1. [item1](http://link1)
2. [item2](http://link2)
3. [item3](http://link3)
''')

Thanks is there a quick way to convert the Python List I have into a markdown one?

You can do it with a list comprehension: html.Ul([html.Li(x) for x in my_list])

2 Likes

Thanks that worked a treat!

@Philippe what if the Python list is inside of a callback?

that really helped,you’re a god

three reasons why you should buy plotly pro: support open source, get great support, host your plots and dashboards online