I have created a big list of server names. I want to present this as a menu to the user and create a new list that will contain only the names/multiple choices selected by the user.
BigList = ['server1','server2','server3','server4']
while (i < len(BigList)):
i =+ 1
print "%d. %s Return to main menu" % (i+1,BigList)
menu = raw_input("Enter the selection with comma:")
menu = menu.split(",")
return menu
When the user selects multiple choices from menu, the list I get is a list of numbers and not the actual server names to return. Also there is no error handling such as if the number is valid from menu or not.
Any help is appreciated, I am new to Python, trying to learn more.
i =+ 1should bei += 1. And given the code as it is, unless you meant to indent more lines it could just bei = len(BigList).