The sprit of this newsgroup!

Irmen de Jong irmen at
Sat Feb 22 11:52:16 CET 2003

Peter Hansen wrote:
> Martijn Faassen wrote:
>>but i figured it out all by myself and soon I can be a senior too:
>>mystring = 'Hello world how are you?"
>>mystring = range(217)
>>mystring[10] = 'F'
>>but now i have a problem printing my string, I get it looking all weird like
>>a lot of numbers and stuff. What is happening?
> Ah, that's called "Unicode".  It's a replacement for "bytes" which
> is coming into vogue these days.  There's another fellow in this
> newsgroup who posts answers about Unicode and I'm sure he'll 
> be along shortly to help you out.  

The usual way to handle "Unicode" stuff is by writing your own decoder
that transforms it again into a readable string, like so:

 >>> newstring=''.join([chr(x) for x in mystring[:10]])+mystring[10] + \
...  ''.join([chr(x) for x in mystring[11:]])
 >>> print newstring

But the print statement contains all kind of weird characters, so
I reckon that your input is wrong. Crap in, Crap out, so you have
to fix your input first.

> He's from somewhere Dutch, I think, like maybe Belgium?

*I* am from The Netherlands...

Irmen de Jong.

More information about the Python-list mailing list