[Tutor] How can I extract a specific sublist from a nested list?

Emad Nawfal (عماد نوفل) emadnawfal at gmail.com
Wed Mar 11 02:44:30 CET 2009


Hi Tutors,
How can I extract a specific sublist (??) from a nested list, for example,
if I want to extract the sublist ["ADJ", "good"], or the bigger sublist
["NP",["DET", "The"],["ADJ", "good"],["NOUN", "man"]] from the following
nested list?

nested_list = ["S",["NP",["DET", "The"],["ADJ", "good"],["NOUN", "man"]],
["VP", ["V", "came"]]]

-- 
لا أعرف مظلوما تواطأ الناس علي هضمه ولا زهدوا في إنصافه كالحقيقة.....محمد
الغزالي
"No victim has ever been more repressed and alienated than the truth"

Emad Soliman Nawfal
Indiana University, Bloomington

--------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090310/44337b7a/attachment.htm>


More information about the Tutor mailing list