如果有重复项,请检查4个字符串

Reg*_*ser 2 python python-2.7

s1,s2,s3,s4有一个字符串作为内容

我想做这样的事情

if one or more is the same s1, s2, s3 or s4:
    print error
else
    print s1, s2, s3, s4
Run Code Online (Sandbox Code Playgroud)

Jon*_*nts 8

你可以使用一套:

if len(set([s1, s2, s3, s4])) != 4:
    pass # not all unique
Run Code Online (Sandbox Code Playgroud)