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)
解决方案
Yes - barring (very unlikely) future changes to ASCII or the C locale, that set of characters should remain constant.