所以基本上,我希望这是 False:
('click', 'bait', 'carrot', 'juice')
这是 True,因为每个字符串都以与其他字符串不同的字符开头:
('click', 'bait', 'juice', 'silly')
我得到的最接近的是下面的,但它看起来一点也不好看。
functools.reduce(lambda x, y: (y, x[0] != y[0]), map(operator.itemgetter(0), ('click', 'bait', 'carrot', 'juice')))[1]
它失败了,因为它只检查彼此相邻的字符串。
请您参考如下方法:
data = ('click', 'bait', 'carrot', 'juice')
len(set(w[0] for w in data)) == len(data)
# -> False
