Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第11课 字符串is运算错误 #59

Open
ghost opened this issue Apr 20, 2024 · 5 comments
Open

第11课 字符串is运算错误 #59

ghost opened this issue Apr 20, 2024 · 5 comments

Comments

@ghost
Copy link

ghost commented Apr 20, 2024

第11课
s1 = 'hello world'
s2 = 'hello world'
s3 = s2

比较字符串的内容

print(s1 == s2, s2 == s3) # True True

比较字符串的内存地址

print(s1 is s2, s2 is s3) # False True

s1 is s2 会返回true
s1 s2 s3三个对象引用同一个字符串池

@bohaz87
Copy link

bohaz87 commented Jun 28, 2024

遇到同样的情况

@mysmomo
Copy link

mysmomo commented Jun 28, 2024 via email

@hbjcstkl2020
Copy link

hbjcstkl2020 commented Jun 28, 2024 via email

@b11152
Copy link

b11152 commented Jun 28, 2024 via email

@CHAMPIOM1
Copy link

CHAMPIOM1 commented Jun 28, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants