taking a value from double list and making it a menu

I have a list of data that reads

[['name','emailtype','phonetype'],['john','yahoomail', 'mobile'],['mark','yahoo','landline']]

I can manually pick out the values i.e print dL[0][0] prints name and dL[1][0] emailtype.

Is it possible to isolate all the names from the list. i.e john and mark. With a program / module and then print them and produce them into something like this:

1) John
2) Mark 

so that I can ask for a raw_input and then if I press 1 as selection it produces john as the answer.

so that it reads similar to the nicely written data that I can manually type as above.

Answers


You want to slice the list (to ignore the first row), then use a list comprehension to pick out just the first element of each nested list:

[row[0] for row in nested_list[1:]]

Need Your Help

_main already defined in file.obj

assembly x86 masm

I am reading a book which teaches assembly using MASM via Visual C++ Express.

GWT Codesplitting and PhoneGap

java gwt cordova mgwt

I am planning on writing a GWT application that will deploy to web and mobile web, as well apps on native devices. To do this I will first compile my GWT into JavaScript, and then use the GWT-Phone...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.