如何在 Python 中比较两个字符串
str1 = "Canada"
str2 = "Canada"
print(str1 is str2) # True
print(str1 == str2) # True
string1 = ''.join(['Ca', 'na', 'da'])
string2 = ''.join(['Can', 'ada'])
print(string1 is string2) # False
print(string1 == string2) # True
Output:
True
True
False
True