Can I change a unicode char to gb2312 using python?

Kick store_li at sina.com
Wed Dec 19 21:54:29 EST 2001


One piece additional, the python said unknown encoding. :-<

"Oleg Broytmann" <phd at phd.pp.ru> wrote in message
news:mailman.1008770961.5358.python-list at python.org...
> 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
that,
> > System.out.println(new String("some chinese char".getBytes()"GB2312"))
> >
> > Is there any python function or method can do the same work?
>
>    http://www.python.org/doc/current/lib/string-methods.html
>
>    Python strings has method "encode":
>
>       u'sigma'.encode('gb2312')
>
> Oleg.
> --
>      Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
>            Programmers don't die, they just GOSUB without RETURN.
>





More information about the Python-list mailing list