[Tutor] Python for Windows: module re, re.LOCALE different for Idle and p ython shell? (original) (raw)

Steckel, Ralf Ralf.Steckel at AtosOrigin.com
Thu Jul 29 09:25:45 CEST 2004


Dear list,

i've written a python script to extract all words from a text file and to print how often they are used. For doing that i use the re module with:

r=re.compile('[\w]+', re.LOCALE | re.IGNORECASE)

The re.LOCALE flag promises that the operating systems local character set is used. As i live in Germany and use a German Windows NT machine i want to include the German 'Umlaute' ('äöüÄÖÜß') in the words of my wordlist.

This works fine if i'm running my script from Idle, but running it from the Windows command prompt or by starting it from the Windows explorer, it doesn't include the German 'Umlaute' in the words, but filters them.

My question is: how do i get for the command line the same environment as for Idle?

I guess this is rather a Windows question than a Python one, because Windows and DOS both support German 'Umlaute', but it seems they do it with different character codes.

Best wishes,

Ralf

PS:

OS is Windows NT 4.0 work station (German) Python is Python 2.3.3 for Windows



More information about the Tutor mailing list