Problems with csv module

Richie Hindle richie at entrian.com
Wed May 11 08:06:20 EDT 2005


[Florian]
> How can I convert Unicode to ASCII?

You're writing code using Unicode and you don't know how to convert it
ASCII?  You need to do some reading.  Here are a few links - Google can
provide many more:

  http://docs.python.org/tut/node5.html#SECTION005130000000000000000
  http://diveintopython.org/xml_processing/unicode.html
  http://www.jorendorff.com/articles/unicode/python.html

The short answer to your question is this:

>>> U = u'My string'
>>> A = U.encode('ascii')
>>> print U, type(U), A, type(A)
My string <type 'unicode'> My string <type 'str'>

but you should really do some reading.

-- 
Richie Hindle
richie at entrian.com




More information about the Python-list mailing list