Python Check list1在list2中,但是顺序排列

时间:2019-05-09 03:07:19

标签: python

Python中是否有一种方法可以检查list1是否在list2中?但是我想检查list1应该在list2中顺序。 基本上我想检查list1以便其他列表。请参阅下面的场景

例如:

list1 = ['word', 'see' 'it' 'self']
list2 = ['tomorrow', 'word', 'yesterday', 'to', 'see', 'it', 'self']
list3 = ['see', 'word', 'self', 'it']
if list1 is in list2:
answer -> true

if list1 is in list3:
answer -> false

0 个答案:

没有答案