[Tutor] redemo.py and r'python\.org'

Kent Johnson kent37 at tds.net
Fri Oct 14 12:04:14 CEST 2005

Dick Moores wrote:
> Kent Johnson wrote at 19:21 10/13/2005:
>> > BTW in redemo.py, what do the checkboxes VERBOSE, LOCALE, and DOTALL
>> > mean? (I understand IGNORECASE and MULTILINE.)
>> http://docs.python.org/lib/node115.html
> OK, but that didn't help with LOCALE. From 
> http://en.wikipedia.org/wiki/Locale
> LOCALE seems to be something I don't need to worry about for a while.

    Make \w, \W, \b, \B, \s and \S dependent on the current locale.

Locale is a setting that affects some operations that differ in different cultures, for example whether a . or , is used as a decimal separator and what the money symbol is. You can access locale settings with the locale module.

The list of word and space characters can differ by locale. This affects the meaning of the \ escapes noted above. Even setting the locale to 'en' (from the default 'C' locale) changes the default letters:

 >>> import string, locale
 >>> string.letters
 >>> locale.setlocale(locale.LC_ALL, 'en')
'English_United States.1252'
 >>> string.letters


More information about the Tutor mailing list