Hello,
Now that I have been instructed as to how to write unicode characters in Python, I would like to know if it is possible to get the unicode characters into a list, dictionary, etc.

Here is my very simple code:

a = u'\u05e9\u05dc\u05d5\u05dd!'
print a
print
print
mylist = ["qwerty","uiop",a]
print mylist

The result I get is:

שלו!


['qwerty', 'uiop', u'\u05e9\u05dc\u05d5\05dd!']

The first printout is correct but when I try to insert this into the list, as can be seen, it prints out the unicode code rather than the unicode characters.

Can this be done?

Iacobus

I see what you mean. Looks like you have to print the elements of the list to get the right result ...

a = u'\u05e9\u05dc\u05d5\u05dd!'
print a
print
print
mylist = ["qwerty","uiop",a]
print mylist

print mylist[2]
# or
for word in mylist:
    print word

Making a dictionary should work, I got to play with that in Spanish.

Yes, I see that works. :D

It gives me something to fiddle with for awhile. :eek:

Thanks very much :)

Hey, by the way, another huge thanks for the code snippets. They are going to be very helpful I'm sure.

Iacobus

This question has already been answered. Start a new discussion instead.