'concatenating''strings'

Will Stuyvesant hwlgw at hotmail.com
Thu Aug 8 14:04:54 EDT 2002


Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit (Intel)] on
win32
Type "copyright", "credits" or "license" for more information.
IDLE 0.8 -- press F1 for help
>>> '1''2'
'12'
>>> '1''2''3'
'123'
>>> '1'''
'1'
>>> '''3'
KeyboardInterrupt
>>> # that did hang with the cursor on the next line so I had to press
CTRL-c
>>> _
'1'
>>> ''+'3'
'3'

Totally unimportant but unexpected behaviour.
Looks like you can not concatenate the empty string '' to 'something'
without using the + operator.


"Exit, pursued by a bear."
                - William Shakespeare



More information about the Python-list mailing list