movies = [
"The Holy Grail",1975,"Terry Jones & Terry Gilliam",91,
["Graham Chapman",
["Micheal Palin","John Cleese","Terry Gilliam","Eric Idle","Terry Jones"]]]
#直接输出
#for each in movies:
# print(each)
"""The Holy Grail
1975
Terry Jones & Terry Gilliam
91
['Graham Chapman', ['Micheal Palin', 'John Cleese', 'Terry Gilliam', 'Eric Idle', 'Terry Jones']]
处理嵌套列表
for each_movie in movies:
if isinstance(each_movie,list):
for each_temp in each_movie:
print(each_temp)
else:
print(each_movie)"""
def print_lol(the_list):
for each_item in the_list:
if isinstance(each_item,list):
print_lol(each_item)
else:
print(each_item)
print_lol(movies)
"The Holy Grail",1975,"Terry Jones & Terry Gilliam",91,
["Graham Chapman",
["Micheal Palin","John Cleese","Terry Gilliam","Eric Idle","Terry Jones"]]]
#直接输出
#for each in movies:
# print(each)
"""The Holy Grail
1975
Terry Jones & Terry Gilliam
91
['Graham Chapman', ['Micheal Palin', 'John Cleese', 'Terry Gilliam', 'Eric Idle', 'Terry Jones']]
处理嵌套列表
for each_movie in movies:
if isinstance(each_movie,list):
for each_temp in each_movie:
print(each_temp)
else:
print(each_movie)"""
def print_lol(the_list):
for each_item in the_list:
if isinstance(each_item,list):
print_lol(each_item)
else:
print(each_item)
print_lol(movies)