add two strings

David Lambert dave at lambsys.com
Mon Jan 30 23:25:43 EST 2012


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.




More information about the Python-list mailing list