[Tutor] Type error: must be string or read-only character buffer, not seq
Peter Otten
__peter__ at web.de
Tue Apr 19 17:29:55 CEST 2011
Kann Vearasilp wrote:
> I tried concatenating string variables with multiple strings and have the
> file handle write the statement into a file. I don't know why I always get
> the type error: must be string or read-only character buffer, not seq
> error. I tried casting the whole new concatenated string using str(), but
> was not successful as well. Do you have any clue why this happen?
> 52 str(statement)
> 53 insert.write(statement)
Line 52 doesn't do what you think it does -- it converts statement to a
string and then discards the result.
Try
statement = str(statement)
insert.write(statement)
or
insert.write(str(statement))
instead.
More information about the Tutor
mailing list