我需要检查是否有两个单词同时出现。例如: string_im_searching = "John ate a big red apple." 我需要知道“大红”这个字串是否存在。或者,我需要知道字符串"big“后面是不是字符串"red” some_other_string = "John is big and the apple is red." 上面的字符串不应返回正数。是的,它有"big"和"red",但它们没有
我有一个大约90k元素的列表(大约670个唯一的)。我想得到每个值第一次出现的索引。我刚刚试过这样理解列表:
In: [["foo", "bar", "baz", "bar", "foo"].index(x) for x in ["foo", "bar", "baz", "bar","foo"