Reputation: 153
When i am trying to compare the identity of two variable containing same string, python gives me different result.
msg = "hello world"
new_msg = "hello world"
print( msg is new_msg )
> False
But,
msg = "hello_world"
new_msg = "hello_world"
print( msg is new_msg )
> True
Upvotes: 0
Views: 36