Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #19623

Re: add two strings

Date 2012-01-30 22:25 -0600
From David Lambert <dave@lambsys.com>
Subject Re: add two strings
References <CA+YdQ_6cp=9dQ65P3TTNTJLG54stCiX9x1RNSV=4akVQQKUTFw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.5229.1327983955.27778.python-list@python.org> (permalink)

Show all headers | View raw


On 01/30/2012 07:02 AM, contro opinion wrote:
> >>> s1='\x45'
> >>> s2='\xe4'
> >>> s1+s2
> 'E\xe4'
> >>> print  s1+s2
> E
>
> why  s1+s2  not  =  '\x45\xe4'??
>
It is, but '\x45' is ASCII 'E', and '\xe4' is not a printable character:
 >>> print '\x45'
E
 >>> print  '\xe4'

 >>>
Try printing s1 and s2 separately in your example.

HTH,

Dave.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: add two strings David Lambert <dave@lambsys.com> - 2012-01-30 22:25 -0600

csiph-web