[Tutor] Type error: must be string or read-only character buffer, not seq
Kann Vearasilp
vearasilp at gmail.com
Tue Apr 19 18:10:59 CEST 2011
Thanks Peter,
That just fixes my problem. : )
Kann
On Tue, Apr 19, 2011 at 5:29 PM, Peter Otten <__peter__ at web.de> wrote:
> 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.
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
More information about the Tutor
mailing list