How to convert unicode list to ascii list?

Mark Kingston mkingston at shaw.ca
Wed Mar 19 23:33:37 EST 2003


Thanks for your help Brian.

Looking at your example, I realized that I made the mistake of doing this to
the list first:
   repr(groups)
and then
    groups[0]

Thanks again.

Mark.



"Brian Munroe" <bmunroe at tribador.nu> wrote in message
news:mailman.1048128336.30199.python-list at python.org...
> > -----Original Message-----
> > On Behalf Of Mark Kingston
> > Sent: Wednesday, March 19, 2003 5:53 PM
> > To: python-list at python.org
> > Subject: How to convert unicode list to ascii list?
> >
> > I tried accessing the elements using:
> >    firstElement = groups[0]
> > but it returns only this:  '['
> >
> > How can I convert this list to a normal ASCII list so that I can access
each
> > element as ASCII?
> >
>
> you can use str(groups[0]) to convert it, but I tried your example via the
> command interpeter that comes with ActivePython 2.2.2 and it returned
'Debugger
> Users', so maybe something else is wrong with your install?
>
> -- brian
>
>






More information about the Python-list mailing list