[英]Any function which says if a sublist[i.e. something] exists inside a list or not?
Is there any simple function which says if a sub-list [ie Something or Anything] exits within a list or not ?是否有任何简单的函数可以说明子列表 [即某物或任何东西] 是否存在于列表中?
For Example: a.例如: a. Says there is a top list, ie top_list = [] b.
说有一个顶级列表,即top_list = [] b。 Next check if some sub-list exits or not ie if top_list[0] exits or not ?
接下来检查某些子列表是否存在,即 top_list[0] 是否存在? Something like, top_list is [[]].
就像,top_list 是 [[]]。 That sub-list can be just an empty list [] or a list with some number etc..
该子列表可以只是一个空列表 [] 或带有一些数字等的列表。
Just wanted to find if a sub-list exits within a list or not ?只是想查找子列表是否存在于列表中? Kindly drop in your comments if you have any suggestions.
如果您有任何建议,请留下您的意见。
Thanks in Advance, Vimo提前致谢, Vimo
This: https://stackoverflow.com/a/5148526/6194839 will check for a non-sequential list.这个: https : //stackoverflow.com/a/5148526/6194839将检查非顺序列表。
Checking for a sequential list I would just brute force it, looking through the list for an entry that matches the first in your sub-list, then checking for the rest.检查顺序列表我只会强制执行它,在列表中查找与子列表中的第一个匹配的条目,然后检查其余的条目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.