Hat difference between "" and '' in string definition

Steve D'Aprano steve+python at pearwood.info
Sat Sep 9 20:07:22 EDT 2017


On Sun, 10 Sep 2017 05:47 am, Stefan Ram wrote:

> Andrej Viktorovich <viktorovichandrej at gmail.com> writes:
>>What is difference between string definitions:
>>s="aaa"
>>and
>>s='bbb'
> 
>   These two assignment statements differ in their
>   last five characters.
> 
>   Their difference can be calculated thus:
> 
> |>>> int.from_bytes \
> |... ( bytearray( 's="aaa"', 'us-ascii' ), \
> |...   byteorder='big', signed=False )- \
> |... int.from_bytes \
> |... ( bytearray( "s='bbb'", 'us-ascii' ), \
> |...   byteorder='big', signed=False )
> |-21491679493
> 
>   .

And they say Germans have no sense of humour :-)




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list