Can I change a unicode char to gb2312 using python?

Kick store_li at
Thu Dec 20 03:41:14 CET 2001

Thank you! But what I want to change is a variable. How can I use this
method? Just f.encode("gb2312")?

But python told me that out of range(128).What shall I do ?

Thank you!
"Oleg Broytmann" <phd at> wrote in message
news:mailman.1008770961.5358.python-list at
> On Wed, Dec 19, 2001 at 09:46:41PM +0800, Kick wrote:
> > I know that Java have a method that can manually encode string, like
> > System.out.println(new String("some chinese char".getBytes()"GB2312"))
> >
> > Is there any python function or method can do the same work?
>    Python strings has method "encode":
>       u'sigma'.encode('gb2312')
> Oleg.
> --
>      Oleg Broytmann              phd at
>            Programmers don't die, they just GOSUB without RETURN.

More information about the Python-list mailing list