Newbie Question about sequence multiplication
bdesth.quelquechose at free.quelquepart.fr
Wed Apr 4 19:30:43 EDT 2007
Scott a écrit :
> print ' ' * left_margin + '| ' + ' ' sentence + ' |'
a '+' is missing here
> Now if i put * before sentence as it is with the rest of the variables, it
> actually gets to the point where it asks me for the sentence, but after
> inputting my sentence I receive:
> Traceback (most recent call last):
> File "D:/Programming/Python/sequence string multiplication example", line
> 16, in <module>
> print ' ' * left_margin + '| ' + ' ' * sentence + ' |'
> TypeError: can't multiply sequence by non-int of type 'str'
Of course. You can't multiply a string by another string.
More information about the Python-list