[Tutor] Dictionary Format

Kirby Urner urnerk@qwest.net
Tue, 05 Mar 2002 16:52:27 -0800


At 04:47 PM 3/5/2002 -0600, Bryce Embry wrote:
>Howdy,
>I'm working on a script to help with some Windows 2000
>administration and have run into a little dictionary glitch
>that confuses me.

You're running up against the fact that user names
are being stored in unicode, vs. ascii.  This is
a manifestation of the internationalization trend.

Look in Section 3.1.3 Unicode Strings in the online
tutorial.

I'm not sure why you don't get a match when you search
a list of users for a given user:

     'auser' in [u'auser', u'buser', u'cuser', u'duser']

returns 1, even though 'auser' is an ordinary string.

Note:  in the above-mentioned tutorial section, we find
the following user-input and Python response:

   >>> u"=E4=F6=FC".encode('utf-8')   # a,o,u with double-dots above
   '\xc3\xa4\xc3\xb6\xc3\xbc'

I find this doesn't work in Windows IDLE, but does in
a DOS-based Python session.  I was previously unaware
of IDLE's limitations vis-a-vis unicode.

Kirby

"You acknowledge that Software is not designed, licensed
or intended for use in the design, construction, operation
or maintenance of any nuclear facility." -- Java license
agreement