标签: python string
请考虑以下两种情况:
>>> a = "python is cool!" >>> b = "python is cool!" >>> a is b False
和
>>> a = "python" >>> b = "python" >>> a is b True # a and b refer to the same object!
我想知道为什么在第二种情况而不是第一种情况下发生字符串实习。是由于感叹号还是一般长度?谢谢!