python / will c local change string.punctuation

2019-04-13 15:03发布

问题:

According to the docs, string.punctuation contains: String of ASCII characters which are considered punctuation characters in the C locale.

If I print string.punctuation I get !"#$%&'()*+,-./:;<=>?@[]^_`{|}~

Can I rely on that this string is always the same because it contains all ASCII punctuation characters or is the locale setting somehow important for this?

(I am using Python 2.7 on Xubuntu 12.04 with LANG=en_US.UTF-8)

回答1:

Yes - barring (very unlikely) future changes to ASCII or the C locale, that set of characters should remain constant.