最近在看python标准库这本书,第一感觉非常厚,第二感觉,里面有很多原来不知道的东西,现在记下来跟大家分享一下. string类是python中最常用的文本处理工具,在python的标准库中,有大量的工具,可以帮助我们完成高级文本处理. capwords()是将一个字符串中的所有单词的首字母大写. import string s = 'The quick brown fox jumped over the lazy dog.' print s print string.capw
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! 在"循环"一节,我们已经讨论了Python基本的循环语法.这一节,我们将接触更加灵活的循环方式. range() 在Python中,for循环后的in跟随一个序列的话,循环每次使用的序列元素,而不是序列的下标. 之前我们已经使用过range()来控制for循环.现在,我们继续开发range的功能,以实现下标对循环的控制: S = 'abcdefghijk' for i
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