Home > other >  The python string address problems
The python string address problems

Time:11-16

Before who had sent again don't know whether to delete the python small white a asked a question that I really care, I check the string in the python3.8.2 code is the result of this
> Id (' CPCCP ')
4300388336
> Id (' oee8ed.)
4300388336
But not so in 3.7
Id (' CPCCP ')
4368612352
Id (' oee8ed ')
4370164792
Why different string address in 3.8, in 3.7 the inside address is different, do you have a great god can help to solve it, as if no one ask this question everywhere, I'm here to see,
But also seems to have the same point, the following & gt;> A='apple'
> B='basket'
> A + b is' applebasket # a + b or a + 'basket' is a false
: 1: SyntaxWarning: "is" with a literal. Did you mean "=="?
False
> Id (a + b)
4300389360
> Id # (" apple "+ b) output address is the same
4300389360
> Id (' apple '+' basket ')
4300389360
=================================================
A='apple' # python3.7
B='basket'
A + b is' applebasket '
False
Id (a + b)
4369049264 # is different from the address below
Id (a + 'basket')
4366530480


As above, if you can solve many thanks
  • Related