R: unicode to string conversion

Martin v. Löwis martin at v.loewis.de
Fri May 9 05:17:30 EDT 2003


"Luca Calderano" <calderano at sgaspa.it> writes:

> I would like to transform the unicode string:
> 
> 	u= u'più'
> 
> into an usual string:
> 
> 	s = 'più'

You still have misrepresented the problem, and this is probably most
likely becaus you don't fully understand what the problem is.

As stated, you seem to ask on how to perform a change in source
code. I.e. if you have a file x.py that contains

u= u'più'

you want this file to look like this

s = 'più'

To do so, open x.py in an editor, and change the first occurrence of
'u' to 's', and remove the second occurrence of u, and, voilà, you get
the "usual" string.

If this is not what you want, and what Skip told is also not what you
want, you should explain in more detail what it is that you want,
perhaps by giving some of your application context.

Regards,
Martin





More information about the Python-list mailing list