Cómo escanear la lista de la lista IFI
-
20-12-2019 - |
Pregunta
Tengo un programa Python 3.3 y me gustaría tener algo como el siguiente trabajo.¿Cómo puedo conseguirlo para revisar la lista?¡Simplemente me da un error!
app_list = ["Item1", "Item2", Item3"]
elif menu == "open " + in app_list:
do_stuff()
Solución
Suena como si quieres algo así:
app_list = ["Item1", "Item2", "Item3"]
elif menu.startswith("open ") and menu[5:] in app_list:
do_stuff()
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow