JUNE 28TH, 2014Tweet This article describes how Python string interning works in CPython 2.7.7. A few days ago, I had to explain to a colleague what the built-in function intern does. I gave him the following example: >>> s1 = 'foo!' >>>…
http://www.laurentluce.com/posts/python-string-objects-implementation/ Python string objects implementation June 19, 2011 This article describes how string objects are managed by Python internally and how string search is done. PyStringObject structu…
最近在看python标准库这本书,第一感觉非常厚,第二感觉,里面有很多原来不知道的东西,现在记下来跟大家分享一下. string类是python中最常用的文本处理工具,在python的标准库中,有大量的工具,可以帮助我们完成高级文本处理. capwords()是将一个字符串中的所有单词的首字母大写. import string s = 'The quick brown fox jumped over the lazy dog.' print s print string.capw…