Novice: replacing strings with unicode variables in a list

Fredrik Lundh fredrik at pythonware.com
Wed Dec 6 04:51:51 EST 2006


Diez B. Roggisch wrote:

> Please provide the full script, and the desired input - then we might be
> able to help you.

the full *traceback* would pretty useful, too:

http://effbot.org/pyfaq/tutor-i-need-help-im-getting-an-error-in-my-program-what-should-i-do.htm

my guess is that the OP left out the print statement that causing the error, and the
traceback lines that pointed to that print statement:

> more test.py
uni = u"p\x95l"
print uni

> python test.py
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    print uni
  File "C:\python25\lib\encodings\cp850.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
UnicodeEncodeError: 'charmap' codec can't encode character u'\x95' in position 1
: character maps to <undefined>

</F> 






More information about the Python-list mailing list