Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiplying a string with a number results in "TypeError: can't multiply sequence by non-int of type 'str'"

Tags:

I need a string consisting of a repetition of a particular character. At the Python console, if I type:

n = '0'*8

then n gets assigned a string consisting of 8 zeroes, which is what I expect.

But, if I have the same in a Python program (.py file), then the program aborts with an error saying
can't multiply sequence by non-int of type 'str'

Any way to fix this?