Question

I have a Python 3.3 program and I would like to have something like below work. How can I get it to check the list? It simply gives me an error!

        app_list = ["Item1", "Item2", Item3"]
        elif menu == "open " + in app_list:
             do_stuff()
Was it helpful?

Solution

It sounds like you want something like:

    app_list = ["Item1", "Item2", "Item3"]
    elif menu.startswith("open ") and menu[5:] in app_list:
         do_stuff()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top