string module

Tim Peters tim.one at comcast.net
Mon May 20 02:13:14 EDT 2002


[Phil Hystad]
> For example, string.uppercase has the following values:
>
> ABCDEFGHIJKLMNOPQRSTUVWXYZ\xC0\xC1\xC2....\xCde

Here's the C code that creates this:

	n = 0;
	for (c = 0; c < 256; c++) {
		if (isupper(c))
			buf[n++] = c;
	}

So you get whatever your platform C's isupper() function says is an
uppercase letter; this may vary according to locale and platform C bugs.

If you're married to ASCII, use string.ascii_lowercase,
string.ascii_uppercase, and string.ascii_letters instead.






More information about the Python-list mailing list