How to search and display name of a list in python?
Your question is not clear. But are you trying to do something as follows:
playlists = {'playlist1': ["1", "2", "3"], 'playlist2': ["4", "5", "6"],
'playlist3': ["7", "8", "9"]}
search = input("Whats the name?")
if search in playlists.keys():
print(playlists[search])
else:
print("Wrong")
If the user gives input as playlist2
, the program will print [4, 5, 6]
.